Posts

Showing posts from March, 2015

javascript - Cufon: Underline Text -

how can underline text replaced cufon? text-decoration not supported cufon: http://wiki.github.com/sorccu/cufon/known-bugs-and-issues perhaps add border-bottom property element using normal css?

c# - How to exclude seconds from DateTime.ToString() -

i using datetime.now.tostring() in windows service , giving me output "7/23/2010 12:35:07 pm " want exclude second part, displaying minute. so how exclude seconds format...? output short date pattern: datetime.now.tostring("g") see msdn full documentation.

How to tweak Eclipse's C++ Indexer? -

i'm using eclipse ide c++ project, , love tell me given symbol defined , parameters function. however, there's catch: use lazy c++ , tool takes single source file , generates .h , .cpp files. .lzz files headers, tool supports mild syntactic benefits, combining nested namespaces qualified name. additionally, has special tags tell tool put (in header or in source file). so typical sourcefile.lzz looks this: $hdr #include <iosfwd> #include "projecta/baseclass.h" $end $src #include <iostream> #include "projectb/otherclass.h" $end // forward declarations namespace bigscope::projectb { class otherclass; } namespace bigscope::projecta { class myclass : public projecta::baseclass { void somemethod(const projectb::otherclass& foo) { } } } as see, it's still recognizable c++, few extras. for reason, cdt's indexer not seem want index anything, , don't know what's wrong. in indexer view, shows me empty tree, t...

.net - How do I get the current state of Caps Lock in VB.NET? -

how find out whether or not caps lock activated, using vb.net? this follow-up earlier question . http://msdn.microsoft.com/en-us/library/system.windows.forms.control.iskeylocked.aspx imports system imports system.windows.forms imports microsoft.visualbasic public class capslockindicator public shared sub main() if control.iskeylocked(keys.capslock) messagebox.show("the caps lock key on.") else messagebox.show("the caps lock key off.") end if end sub 'main end class 'capslockindicator using system; using system.windows.forms; public class capslockindicator { public static void main() { if (control.iskeylocked(keys.capslock)) { messagebox.show("the caps lock key on."); } else { messagebox.show("the caps lock key off."); } } }

winapi - Does Windows Server 2003 SP2 tell the truth about Free System Page Table Entries? -

we have win32 console applications running on windows server 2003 service pack 2 regularly fail this: error 1450 ( error_no_system_resources ): "insufficient system resources exist complete requested service." all documentation we've found suggests linked number of free system page table entries running out. have 16gb ram in these machines , use /3gb operating system switch squeeze windows kernel 1gb , allow our processes access 3gb of address space. drastically reduces total number of free system page table entries, combined our heavy use of mapviewoffile() perhaps not surprising kernel page table entries running out. however, when using performance monitor view free system page table entries counter, value around 36,000 on reboot , doesn't go down when our application starts . find hard believe our application, opens many large memory-mapped files, doesn't have effect on kernel page table. if can't believe counter, it's more difficult...

Nested loop comparison in Python,Java and C -

the following code in python takes long run. (i couldn't wait until program ended, though friend told me him took 20 minutes.) but equivalent code in java runs in approximately 8 seconds , in c takes 45 seconds. i expected python slow not much, , in case of c expected faster java slower. jvm using loop unrolling technique achieve speed? there reason python being slow? import time st=time.time() in xrange(0,100000): j in xrange(0,100000): continue; print "time taken : ",time.time()-st gcc 4.2 -o1 flag or higher optimize away loop , program takes 1 milli second execute. benchmark not representative far real world use. you're doing nested loop reason, , never leave empty. python doesn't optimize away loop, although see no technical reason why couldn't. python slower c because it's further machine language. xrange nice abstraction adds heavy layer of machine code compared simple c loop. c source: int main( void ){ ...

c++ - glBufferData fails silently with overly large sizes -

i noticed, glbufferdata fails silently when try call size: 1085859108 , data: null. following calls glbuffersubdata fail out_of_memory 'exception'. on windows xp 32bit, nvidia gforce 9500 gt (1024mb) , 195.62 drivers. is there way determinate if buffer created sucessfully? (something proxy texture example?) kind regards, florian i doubt it's silent. i'd guess glgeterror return gl_out_of_memory after attempt.

caching - How should a cache key be created from multiple keys? -

i have method output i'll caching. takes 4 parameters; string , string , int , , windowsidentity . need create cache key based on 4 parameters. best to: concatenate them strings , use key? var key = string.concat(string1, string2, int1.tostring(), identity.tostring()); or xor hash codes? var key = string1.gethashcode() ^ string2.gethashcode() ^ int1.gethashcode() ^ identity.gethashcode(); or else? matter? in particular case, these keys going hashtable (c# v1). create new type encapsulates 4 values. example: public sealed class user { private readonly string name; private readonly string login; private readonly int points; private readonly windowsidentity identity; public user(string name, string login, int points, windowsidentity identity) { this.name = name; this.login = login; this.points = points; this.identity = identity; } public string name { { return name; } } pub...

language agnostic - How can one learn multi-threaded parallel programming? -

no matter how proficient @ programming c or java, should consider adding multi-threaded programming set of skills. this not should try learn on own. harder learn sequential programming. if technical manager, should invest in retraining key staff in multi-threaded programming. might monitor research activities in concurrent programming languages (like listed above). can sure competitors will. this quote this article . imagine of here proficient in teaching ourselves different languages, data structures, algorithms, etc, , recognize mental shift needs occur parallel programming right. i reject idea 1 cannot learn parallel programming "right" on own. what's responsible way teach oneself parallel programming? books , other resources recommended? edit: here more details. applying these scientific computing, looking general, language-agnostic material/advice. looking heathy dose of practical theory. imagine have excellent developer loves math , computer sci...

Oracle distributed databases and MSVC -

i using visual studio 2008 c# , sql development. which oracle version should download? oracle 10g? does have design interface sql server mangement studio? will distribution concept have graphical tool "hi, on servers distributed database , on basis"? using local application, when connect server , try enter or delete data not on server, oracle db management system transparently access other servers or insert data? or produce error? in reverse order: oracle not distributed in way (seem to) imagine. it's not voldemort or cassandra. it's 1 database per server, unless you're talking rac: rac shared everything, it's transparent (but way complicated). the nearest oracle has sql server management studio is, guess, enterprise manager. suspect oem not easy use mssql counterpart. if have free choice use 11gr2. why wouldn't not use latest version? oracle support 1 application using multiple databases. however, due existing (even le...

C# AJAX Multiple File Uploads? -

i have asp.net, c# page accepts text , (currently) 1 file ms ajaxtoolkit asyncfileupload. however, want users able upload multiple files - upload 1 files or 10 files. what's best way handle this? ideally, i'd them upload 1 file @ time, , once file finishes uploading, control appears ready accept file (or can remain blank because user finished uploading). so i'm looking 2 answers. 1 how handle gui side of , other codebehind - how multiple files when there 1 or 10 controls check? if have access asp.net mvc, take here

javascript - Scriptaculous Ajax.Autocompleter extra functionality in LI -

i'm using ajax.autocompleter class prototype/scriptaculous library calls asp.net webhandler creates unordered list list items contain suggestions. now i'm working on page can add suggestions 'stop words' table, means if occur in table, won't suggested anymore. i put button inside li elements , when click on it should ajax request page adds word table. works. want suggestions refreshed instantly, suggestions appear without word added table. preferably selected word word next or before clicked word. how do this? happens instead li clicked button of gets selected word , suggestions disappear. the list items this: <li>{0} <img onclick=\"deleteword('{0}');\" src=\"delete.gif\"/> </li> where {0} represents suggested word. javascript function deleteword(w) gets call webhandler can add word 'stop words' table. scriptaculous autocompleter monitors onclick event on 'li'. when stick imag...

web applications - How to cross-domain identify a user with third-party cookies? -

i doing internship in ad-targeting startup. we have publishers in our network can display ads send them. our system able analyze behaviour of user whenever visits 1 of our publishers. on publisher's site, javascript code creates user id. javascript code stores user id in cookie able identify user visits. but same physical user can have different usernames on 2 of our publishers. example "john doe" can "johnd" on publisher , "john_doe" on publisher b. want identify same user anywhere go in our publisher network. have seen third-party cookies combined tracking pixels (or tracking pixel scripts) perhaps solution: indeed these techniques used lot of ad companies cross-domain user tracking. i don't know if these techniques fit want do. if so, wonder how (i quite new field). have ideas, advice, or documentation how architect this? thanks problem resolved : follow this link more details.

c++ - How do I disassemble a VC++ application? -

i believe application has parts target .net, , don't. i'm particularly interested in looking @ resource files, if there any. to add aku's excellent answer, english speakers, ida pro available @ http://www.hex-rays.com/ .

c# - Bestpractice approaches for reverse engineering VB6 code with out knowledge of the domain -

target state: porting vb6 code c#, undertake whole project conceivable processes involved. what approach if not have knowledge domain? there documentation, legacy code (up 100.000 - 300.000 lines of code , comments vb6 files contain 14.000 lines of code) written in vb6. disclaimer: work great migrations we rewrite large vb6/asp/com applications .net (primarily c#) living , have developed software analysis , reengineering tool it. tool vb6/asp/com compiler , decompiler authors .net codes. of course since vb6 platform different .net, direct compile/decompile not desirable or viable, our tool has "analyzer" implements various code reengineering algorithms deal vb6-c# incompatibilities. there programmable "author" allows migration team prescribe rules setting .net code files, restructuring code, , doing things replacing com apis , activex controls .net classes -- depending on team needs or wants. as product of compiling , analyzing code our tool ...

What languages have higher levels of abstraction and require less manual memory management than C++? -

i have been learning c++ while now, find powerful. but, problem the level of abstraction not , have memory management myself. languages can use uses higher level of abstraction. java, c#, ruby, python , javascript big choices before you. java , c# not hugely different languages. big difference you'll find c++ memory management (i.e. objects automatically freed when no longer referenced). chose these if interested in desktop style applications, or keen on static typing (and you'd choose between them based on how feel towards microsoft , windows platform). in both cases you'll find richer standard libraries you'll used c++. python , ruby take step away static typing, world can call , method on object (and fail @ runtime if it's not there). both blessing (a lot less boilerplate code) , curse (the compiler can't catch errors anymore). once again, you'll find have richer standard libraries, , higer level again java / c#. performance main dow...

networking - Virtualbox host-guest network setup -

how set network between host , guest os in windows vista? give guest 2 network adapters, 1 nat , other host-only. nat 1 allow guest see internet, , host-only 1 allow host see guest. one of them allows guest see host. i'm not sure which, know works since i've tested web server stuff it. have choose right ip address, 10.x.x.x or 192.168.x.x. also, may have careful having file , printer sharing running on both adapters @ once, since guest see own name , conflict itself. ran during install.

layout - DIV's vs. Tables or CSS vs. Being Stupid -

i know tables tabular data, it's tempting use them layout. can handle div's 3 column layout, when got 4 nested div's, tricky. is there tutorial/reference out there persuade me use div's layout? i want use div's, refuse spend hour position div/span want it. @garyf: blueprint css has css's best kept secret. great tool - blueprint grid css generator . there's yahoo grid css can sorts of things. but remember: css not religion . if save hours using tables instead of css, so. one of corner cases never make mind forms. i'd love in css, it's more complicated tables. you argue forms tables, in have headers (labels) , data (input fields).

Poor Performance of Java's unzip utilities -

i have noticed unzip facility in java extremely slow compared using native tool such winzip. is there third party library available java more efficient? open source preferred. edit here speed comparison using java built-in solution vs 7zip. added buffered input/output streams in original solution (thanks jim, did make big difference). zip file size: 800k java solution: 2.7 seconds 7zip solution: 204 ms here modified code using built-in java decompression: /** unpacks give zip file using built in java facilities unzip. */ @suppresswarnings("unchecked") public final static void unpack(file zipfile, file rootdir) throws ioexception { zipfile zip = new zipfile(zipfile); enumeration<zipentry> entries = (enumeration<zipentry>) zip.entries(); while(entries.hasmoreelements()) { zipentry entry = entries.nextelement(); java.io.file f = new java.io.file(rootdir, entry.getname()); if (entry.isdirectory()) { // if directory, create conti...

oop - PHP Object question -

using simple set of objects example in php. lets say: objecta: properties: descid; methods : getlistofdata(); objectb: properties: descid;descname; methods: getdescnamebyid(); what want know best way descname objectb when objecta 1 calling function within loop. i'm thinking need instantiate objectb (as new) , pass in objecta.descid objectb.getdescnamebyid method. for example: class objecta { function getlistofdata(){ $myobjb= new objectb(); while ... { $myobjb->descid = $row["descid"]; $mydescname = $myobjb->getdescnamebyid(); ... $i++; } } } i'm pretty sure above work i'm not sure if right way, or if there other ways of doing this. there name type of thing? 1 mentioned lazy loading. in php? bear in mind question needs expansion. a class recipe. object actu...

How do I make a subproject with Qt? -

i'm start on large qt application, made of smaller components (groups of classes work together). example, there might dialog used in project, should developed on own before being integrated project. instead of working on in folder somewhere , copying main project folder, can create sub-folder dedicated dialog, , somehow incorporate main project? here do. let's want following folder hierarchy : /mywholeapp will containt files whole application. /mywholeapp/dummydlg/ will contain files standalone dialogbox part of whole application. i develop standalone dialog box , related classes. create qt-project file going included. contain forms , files part of whole application. file dummydlg.pri, in /mywholeapp/dummydlg/ : # input forms += dummydlg.ui headers += dummydlg.h sources += dummydlg.cpp the above example simple. add other classes if needed. to develop standalone dialog box, create qt project file dedicated dialog : file dummydlg.pro, in /mywholea...

networking - How Do I Access The Host Machine From The Guest Machine? -

i've created new windows xp vm on mac using vmware fusion. vm using nat share host's internet connection. how access rails application, accessible on mac using http://localhost:3000 ? on xp machine, find ip address going command prompt , typing "ipconfig". try replacing last number 1 or 2. example, if ip address 192.168.78.128, use http://192.168.78.1:3000 .

synchronization - Synchronizing Multiline Textbox Positions in C# -

i have c# application wherein there 2 multiline textboxes side-by-side, each in 1 side of split-container. synchronize vertical scroll, when user scrolls or down 1 of textboxes, other textbox scrolls respectively in same direction. there way this? thanks. additional information - 7/26/10 i found interesting apis on msdn website: textbox.getfirstvisiblelineindex method textbox.getlastvisiblelineindex method textbox.scrolltoline method the documentation there looks promising, compiler (microsoft visual c# 2008 express edition) complains when try use it, after adding presenationframework reference , inserting using system.windows.controls; @ top of file: error 1 'system.windows.forms.textbox' not contain definition 'getfirstvisiblelineindex' , no extension method 'getfirstvisiblelineindex' accepting first argument of type 'system.windows.forms.textbox' found (are missing using directive or assembly reference?) additional informat...

c# - Unit Testing Monorail's RedirectToReferrer() -

i trying write unit test action method calls controller.redirecttoreferrer() method, getting "no referrer available" message. how can isolate , mock method? have thought creating test double ?

objective c - IPhone: How to Switch Between Subviews That Were Created in Interface Builder -

so have 2 subviews within main view. created each subview going library in ib , dragging view onto main nib file , positioning controls on them. now, i'd flip between these views via "flip" button. don't understand how can programmatically this. my question is: "hide" 1 of subviews , unhide someway programmatically when flip? give each name via interface builder , way? don't need code flip or anything, need conceptual understanding of how i'd refer views built in ib programmatically , if hiding makes sense in scenerio... any suggestions? thanks you connect things in ib using iboutlet uiview *myview; or @property (nonatomic, retain) iboutlet uiview *myview; in header file. iboutlet keyword tells ib make outlet available connect. you make actual connection in connection inspector dragging outlet view: making connection http://cl.ly/eb3b5cd826b20fc9e307/content (do both views.) note: views don't have inside window in ib...

Saving Java Object Graphs as XML file -

what's simplest-to-use techonlogy available save arbitrary java object graph xml file (and able rehydrate objects later)? the easiest way here serialize object graph. java 1.4 has built in support serialization xml. a solution have used xstream ( http://x-stream.github.io/)- it's small library allow serialize , deserialize , xml. the downside can limited define resulting xml; might not neccessary in case.

regex - Regular Expressions - Parsing a url -

i've delved regular expressions 1 of first times in order parse url. without going depth, want friendly urls , i'm saving each permalink in database, because of differences in languages , pages want save 1 permalink , parse url page , language. if i'm getting this: http://domain.com/lang/fr/category/9/category_title/page/3.html all want bit "category/9/category_title" know page i'm on. i've come function: $return = array(); $string = 'http://domain.com/lang/fr/category/9/category_title/page/3.html'; //remove domain , http $string = preg_replace('@^(?:http://)?([^/]+)@i','',$string); if(preg_match('/^\/lang\/([a-z]{2})/',$string,$langmatches)) { $return['lang'] = $langmatches[1]; //remove lang $string = preg_replace('/^\/lang\/[a-z{2}]+/','',$string); } else { $return['lang'] = 'en'; } //get extension $bits = explode(".", strtolower($string)); $return['ex...

Using jQuery, how can I dynamically set the size attribute of a select box? -

using jquery , how can dynamically set size attribute of select box? i include in code: $("#myselect").bind("click", function() { $("#myotherselect").children().remove(); var options = '' ; (var = 0; < myarray[this.value].length; i++) { options += '<option value="' + myarray[this.value][i] + '">' + myarray[this.value][i] + '</option>'; } $("#myotherselect").html(options).attr [... use myarray[this.value].length here ...]; }); }); oops, it's $('#myselect').attr('size', value)

java - Automatic parallelization -

what opinion regarding project try take code , split threads automatically(maybe compile time, in runtime). take @ code below: for(int i=0;i<100;i++) sum1 += rand(100) for(int j=0;j<100;j++) sum2 += rand(100)/2 this kind of code can automatically split 2 different threads run in parallel. think it's possible? have feeling theoretically it's impossible (it reminds me halting problem) can't justify thought. do think it's useful project? there it? whether it's possible in general case know whether piece of code can parallelized not matter, because if algorithm cannot detect cases can parallelized, maybe can detect of them. that not mean useful. consider following: first of all, @ compile-time, have inspect code paths can potentially reach inside construct want parallelize. may tricky computations. second, have somehow decide parallelizable , not. cannot trivially break loop modifies same state several threads, example. difficult t...

delphi - How do you unit-test code that interacts with and instantiates third-party COM objects? -

one of biggest issues holding me diving full steam unit testing large percentage of code write heavily dependent on third-party com objects different sources tend interact each other (i'm writing add-ins microsoft office using several helper libraries if need know). i know should use mock objects how go in case? can see it's relatively easy when have pass reference existing object of routines instantiate external com objects , pass them on other external com-object yet different library. what best-practice approach here? should have testing code temporarily change com registration information in registry tested code instantiate 1 of mock objects instead? should inject modified type library units? other approaches there? i grateful examples or tools delphi happy more general advice , higher-level explanations well. thanks, oliver the traditional approach says client code should use wrapper, responsible instantiating com object. wrapper can mocked. becau...

Unit testing a method that can have random behaviour -

i ran across situation afternoon, thought i'd ask guys do. we have randomized password generator user password resets , while fixing problem it, decided move routine (slowly growing) test harness. i want test passwords generated conform rules we've set out, of course results of function randomized (or, well, pseudo-randomized). what guys in unit test? generate bunch of passwords, check pass , consider enough? a unit test should same thing every time runs, otherwise may run situation unit test fails occasionally, , real pain debug. try seeding pseudo-randomizer same seed every time (in test, is--not in production code). way test generate same set of inputs every time. if can't control seed , there no way prevent function testing being randomized, guess stuck unpredictable unit test. :(

.net - Making a WinForms TextBox behave like your browser's address bar -

when c# winforms textbox receives focus, want behave browser's address bar. to see mean, click in web browser's address bar. you'll notice following behavior: clicking in textbox should select text if textbox wasn't focused. mouse down , drag in textbox should select text i've highlighted mouse. if textbox focused, clicking not select text. focusing textbox programmatically or via keyboard tabbing should select text. i want in winforms. fastest gun alert: please read following before answering! guys. :-) calling .selectall() during .enter or .gotfocus events won't work because if user clicked textbox, caret placed clicked, deselecting text. calling .selectall() during .click event won't work because user won't able select text mouse; .selectall() call keep overwriting user's text selection. calling begininvoke((action)textbox.selectall) on focus/enter event enter doesn't work because breaks rule #2 ...

jsf - How do I retrieve the selected rows of a woodstock table -

i have jsf woodstock table checkboxes. when row selected want processing items. managed selection of rowkey objects can't find out how original objects put in back. table populated objectlistdataprovider. always nice able answer own questions. managed solve casting table's data provider objectlistdataprovider , use method 'getobject' original object back.

silverlight oob without window -

can silverlight app without window?? i need somthing top bar (always on top) of windows remote desktop. any chances??? silverlight 4, within trusted out of browser application, supports showing window on top, , customizing window's chrome (with limitations). void mainpage_loaded(object sender, routedeventargs e) { if (app.current.haselevatedpermissions && && application.current.isrunningoutofbrowser) { dispatcher.begininvoke(() => { app.current.host.content.topmost = true; }); } } in out of browser settings (project properties/silverlight/out of browser settings...), select option want, maybe borderless round corners example.

Same JavaScript function returns random results -

i'm confused: function is_valid(name) { var regexp_name = /^(\d|\w)*$/gi; return regexp_name.test(name); } // console console.log(is_valid("test")); => true console.log(is_valid("test")); => false console.log(is_valid("test")); => true console.log(is_valid("test")); => false what doing wrong? remove /g flag. the regexp object somehow reused. when /g flag present, regex engine start previous matched location until whole string consumed. 1st call: test ^ after 1st call: test (found "test") ^ 2nd call: test ^ after 2nd call test (found nothing, reset) ^ btw, \w equivalent [0-9a-za-z_] in javascript. therefore, \d| , /i flag redundant. , since you're not using captured group, there's no need keep (…) . following enough: var regexp_name = /^\w*$/;

usrp - USRP2: Number of A/D Converters -

why there 2 a/d converters on usrp2 board if can use 1 rx daughtercard? most of daughterboards quadrature downconversion , produce analog & q. daughterboards use 1 a/d , 1 q.

What is a simple and efficient way to find rows with time-interval overlaps in SQL? -

i have 2 tables, both start time , end time fields. need find, each row in first table, of rows in second table time intervals intersect. for example: <-----row 1 interval-------> <---find this--> <--and this--> <--and this--> please phrase answer in form of sql where -clause, , consider case end time in second table may null . target platform sql server 2005, solutions other platforms may of interest also. select * table1,table2 table2.start <= table1.end , (table2.end null or table2.end >= table1.start)

c# - ASP.NET MVC NerdDinner Tutorial question -

i'm following scott guthries mvc tutorial ( http://nerddinnerbook.s3.amazonaws.com/part6.htm ) , there's don't understand. the controller class called dinnerscontroller has following create methods: public actionresult create() { dinner dinner = new dinner() { eventdate = datetime.now.adddays(7) }; return view(new dinnerformviewmodel(dinner)); } [acceptverbs( httpverbs.post)] public actionresult create(dinner dinner) { if (modelstate.isvalid) { try { dinner.hostedby = "someuser"; dinnerrepository.add(dinner); dinnerrepository.save(); return redirecttoaction("details", new { id = dinner.dinnerid }); } catch { foreach (var violation in dinner.getruleviolations()) modelstate.addmodelerror(violation.property...

c++ - What does the explicit keyword mean? -

someone posted in comment question meaning of explicit keyword in c++. so, mean? the compiler allowed make 1 implicit conversion resolve parameters function. means compiler can use constructors callable single parameter convert 1 type in order right type parameter. here's example class constructor can used implicit conversions: class foo { public: // single parameter constructor, can used implicit conversion foo (int foo) : m_foo (foo) { } int getfoo () { return m_foo; } private: int m_foo; }; here's simple function takes foo object: void dobar (foo foo) { int = foo.getfoo (); } and here's dobar function called. int main () { dobar (42); } the argument not foo object, int . however, there exists constructor foo takes int constructor can used convert parameter correct type. the compiler allowed once each parameter. prefixing explicit keyword constructor prevents compiler using constructor implicit conversions. adding ...

sql - How to 'add' a column to a query result while the query contains aggregate function? -

i have table named 'attendance' used record student attendance time in courses. table has 4 columns, 'id', 'course_id', 'attendance_time', , 'student_name'. example of few records in table is: 23    100    1/1/2010 10:00:00    tom 24    100    1/1/2010 10:20:00    bob 25    187    1/2/2010 08:01:01    lisa ..... i want create summary of latest attendance time each course. created query below: select course_id, max(attendance_time) attendance group course_id the result this 100    1/1/2010 10:20:00 187    1/2/2010 08:01:01 now, want add 'id' column result above. how it? i can't change command this select id, course_id, max(attendance_time) attendance group id, course_id because return records if aggregate function not used. please me. ...

authentication - Authenticating in PHP using LDAP through Active Directory -

i'm looking way authenticate users through ldap php (with active directory being provider). ideally, should able run on iis 7 ( adldap on apache). had done similar, success? edit: i'd prefer library/class code that's ready go... it'd silly invent wheel when has done so. importing whole library seems inefficient when need 2 lines of code... $ldap = ldap_connect("ldap.example.com"); if ($bind = ldap_bind($ldap, $_post['username'], $_post['password'])) { // log them in! } else { // error message }

TV out an iphone application -

using uiscreen api possible display same app screen on both ipod screen , external display. have tried using uiscreen application displaying on external display, not on ipod screen. please guide me on right way see: http://www.expertisemobile.com/2010/06/24/presenting-your-apps-on-the-big-screen-screen-mirroring-for-ios/

Generate View for iPhone application using interface builder.? -

i wanted generate 1 fix view using interface builder, size of view exceeding size of iphone screen,and not able maximize screen. wanted show table view in screen. did enabled scrolling didn't work, update 1: wanted show thumbnail image inside cell , want show 5 cell 5 thumbnail image,those images static. better way achieve ,interface builder or programming? hope clear enough. your question not terribly clear, question attempting answer here: you want have table view has 5 rows, each of has small image. short answer: can't entirely in interface builder. can define table view, including "look," scrolling abilities, etc. , in same xib file define table cells (which can include pictures, captions , have you). you have connect 2 programatically. apple provide plenty of examples in sdk on how this.

android - how to fire an activity from a given activity object -

i have saved object of activity in variable. exit activity. want can use object of activity restart same activity. is possible launch intent of object of activity i not sure of trying hope can help. you can resume resume left in stack activity launching intent activity , setting flag (via intent.setflags method) flag_activity_clear_top clear top of current stack , bring (if exists) called activity. you may consider using sharedpreferences save activity state , resume can skip heavy tasks or whatever want. anyway far know shouldn't keep or pass activity item surely leak: cf: android how avoid memory leak .

display a bg image in table view for iphone -

i can display bg image in table view cell when click cell there blue color filling cell , images goes behind want show image in front of blue color how that?? cell.backgroundview = [[[uiimageview alloc] initwithimage:[uiimage imagenamed:@"supercell.png"]] autorelease]; maybe can use cell.selectionstyle = uitableviewcellselectionstylenone; and cell.selectedbackgroundview = [[[uiimageview alloc] initwithimage:[uiimage imagenamed:@"supercell.png"]] autorelease];

mvvm - WPF Prism Updating ViewModel -

i new prism wpf world, have 1 simple question. i have registered view , viewmodel in module initialise method below var navigatorview = new navigationmenu.view.navigationbarview(); navigatorview.datacontext = m_container.resolve<navigationmenuviewmodel>(); var regionmanager = m_container.resolve<iregionmanager>(); regionmanager.regions[regionnames.navigationmenuregion].add(navigatorview); now if want modify viewmodel way able through viewmodel class only, there other way can update viewmodel object registered unity container. know how can object instance registered unity container. thanks , regards, harry any of vms or modules should have initialize-method, gets container, regionmanager , eventaggregator objects passed via parameters. in first place (like bootstrapper) put them in containers. use method registertype this. can objects resolve method, did in code example. this means, wherever want manipulate s...

Wordpress page with Categories -

i wonna create page list of categories, template. but can't find way how can this. maybe have add new file in template folder? thx best regards take @ template tags/wp list categories « wordpress codex function , code examples. you'll want make page template use function on own page: page templates « wordpress codex.

php - Using AJAX for an auto-updating page containing values from a database? -

can explain how create .php page auto-updates values database? using ajax best this? want php code, want page updated whenever 'values01' added or changed, without having refresh page. $query = "select values01 users username='$username'"; $result = mysql_query($query); while($row = mysql_fetch_array($result, mysql_assoc)) { echo nl2br("{$row['values01']}"); } appreciated! :) what describing push notification web server. unfortunately, have not found reliable way traditional push, web server initiate connection client (from limited research, appears there proposals http standard support push, however, doesn't adopted standard ever emerged). however, can done in bit more roundabout way. there way around push limitation typically used: browser connects page, loads current "state" of database. session variable (lets call $_session['currentstate']) saved starting state of database. javascript ti...

c# - Most efficient data type for UUID in database besides a native UUID -

what efficient data type store uuid/guid in databases not have native uuid/guid data type? 2 bigints? and efficient code (c# preferred) convert , guid type? thanks. it's hard efficient without knowing database using. my first inclination use binary(16) column. as using value in c#, system.guid type has constructor accepts byte[] array, , method tobytearray() returns byte array.

.net - In Silverlight, how to invoke an operation on the Main Dispatch Thread? -

in winforms usercontrol, pass data main gui thread calling this.begininvoke() of control's methods. what's equivalent in silverlight usercontrol? in other words, how can take data provided arbitrary worker thread , ensure gets processed on main displatch thread? use dispatcher property on usercontrol class. private void updatestatus() { this.dispatcher.begininvoke( delegate { statuslabel.text = "updated"; }); }

declarative authorization - rails - declarative_authorization permitted_to not working correctly -

i trying use permitted_to hide/show links in 1 of forms not appearing. the form belongs assignments actual edit function candidates. <% if permitted_to? :edit, @candidate %> <%= link_to 'edit', edit_candidate_path(@candidate) %> <% end %> i can navigate page url know not authorization issue. any ideas ? thanks, alex sorry, found in documentation! <%= link_to 'edit', edit_contact_path(contact) if permitted_to? :update, contact %>

cygwin - Safely change home directory -

i'm trying safely update home directory specified in /etc/passwd , standard linux utils - usermod , vipw - doing aren't provided cygwin. could tell me how changed in cygwin? edit: recent versions of cygwin (1.7.34 , beyond), see this newer question . like sblundy's answer, can edit by-hand. but if want "official" way, use cygwin-specific mkpasswd command. below snippet official docs on mkpasswd : for example, command: example 3.11. using alternate home root $ mkpasswd -l -p "$(cygpath -h)" > /etc/passwd would put local users' home directories in windows 'profiles' directory. there's bunch of other useful commands described on cygwin utilities documentation page (which includes mkpasswd ). use of cygpath in example above of these cygwin-specific tools. while you're @ it, want read using cygwin windows documentation. there's bunch of advice.

.net - File upload and odd browser error -

i have .net 3.5 website uploading files sql server 2008 filestream. works great until hit file size , unexpectedly odd error returns in browser. in ie 7, if upload file size of 100 meg, browser returns after 2 minutes error saying "internet explorer cannot display webpage". generic , totally useless error. timeout issue, expect see error little more explanation. in firefox 3.6.7, when uploading same file browser returns after 4 minutes equally generic , useless error says "the connection reset". again, timeout error (eg - somewhere in code have connection timing out) @ least expect firefox return after 2 minutes generic error, because ie returned after 2 minutes. i need ideas on how diagnose , track down causing problem. also, have file upload size limited 1 gig in web.config. <!-- 1 gig upload --> <httpruntime maxrequestlength="1048576" /> edit: are there settings in iis 7 affecting this? i'm not iis guru, may have config...

ipc - In **portable C**, how to launch a command connecting the command's stdin to the launcher's stdout? -

in c program (p1), how launch dynamically constructed command (and arguments) reads standard input p1's standard output? note that: a method other stdout --> stdin piping ok provided portable across windows , linux. i cannot use c++, java, perl, ruby, python, etc here. also, have mingw dependency windows build? reopened : question below answers linux, question wants portable method. execute program within c program the microsoft c runtime calls _popen instead of popen , appears have same functionality in windows (for console applications) , linux.

ASP.NET MVC - Removing controller name from URL -

i want remove controller name url (for 1 specific controller). example: http://mydomain.com/mycontroller/myaction i want url changed to: http://mydomain.com/myaction how go doing in mvc? using mvc2 if helps me in anyway. you should map new route in global.asax (add before default one), example: routes.maproute("specificroute", "{action}/{id}", new {controller = "mycontroller", action = "index", id = urlparameter.optional}); // default route routes.maproute("default", "{controller}/{action}/{id}", new {controller = "home", action = "index", id = urlparameter.optional} );

c# - Why does IEnumerator<T> inherit from IDisposable while the non-generic IEnumerator does not? -

i noticed generic ienumerator<t> inherits idisposable, non-generic interface ienumerator not. why designed in way? usually, use foreach statement go through ienumerator<t> instance. generated code of foreach has try-finally block invokes dispose() in finally. basically oversight. in c# 1.0, foreach never called dispose 1 . c# 1.2 (introduced in vs2003 - there's no 1.1, bizarrely) foreach began check in finally block whether or not iterator implemented idisposable - had way, because retrospectively making ienumerator extend idisposable have broken everyone's implementation of ienumerator . if they'd worked out it's useful foreach dispose of iterators in first place, i'm sure ienumerator have extended idisposable . when c# 2.0 , .net 2.0 came out, however, had fresh opportunity - new interface, new inheritance. makes more sense have interface extend idisposable don't need execution-time check in block, , compiler knows if ...

sql - Informix: how to get an id of the last inserted record -

what's efficient way of getting value of serial column after insert statement? i.e. looking way replicate @@identity or scope_identity functionality of ms sql the value of last serial insert stored in sqlca record, second entry in sqlerrd array. brian's answer correct esql/c, haven't mentioned language you're using. if you're writing stored procedure, value can found thus: let new_id = dbinfo('sqlca.sqlerrd1'); it can found in $sth->{ix_sqlerrd}[1] if using dbi there variants other languages/interfaces, i'm sure you'll idea.

Ruby and linux, preferred setup? -

mac's have textmate there preferred application ruby development, preferred application linux? need it's easy work multiple files, project structure , setup commands run ruby app or if 1 merb app.syntax highlighting must. now typically use vim, it's not best working multiple files or project structure, vtreeview plug-in or multiple vim windows. so guys suggest? if have better plugins use vim feel free mention them, i'm not ruling out vim here. i use vim on both windows , linux development in rails (we have use windows in work, , use linux @ home). environment same both platforms. important me easy navigation between various rails components - controllers views, partials , models, , quick navigation test files. here plugins use: vim rails tim pope. :r, :a , gf commands ones use navigation. nerdtree project/explorer view. nerdcommenter easy multi-line commenting. fuzzyfinder , " fuzzyfinder - textmate " - allows find files based on...

How can I install a specific version of a set of Perl modules? -

i'm tasked replicating production environment create many test/sit environments. one of things need build perl, modules have been installed (including internal , external modules) on years. use cpan.pm autobundle, result in test environment having newer versions of external modules production has. what easiest/best way , install (a lot of) version specific perl modules. make own cpan mirror want. stratopan.com , service, , pinto , tools that's built on top of, can that. the cpan tools install latest version of distribution because pause indexes latest version. however, can create own, private cpan has distributions want. once have own cpan mirror want, point cpan tools @ mirror installs versions. more on in minute. now, want have several versions of that. can create many mirrors like, , can put mirrors in source control can check out version of mirror like. tools such cpan::mini::inject can set own cpan. check out my talks on slideshare basic examples, ,...

.net - FileNotFoundException with the SPSite constructor -

i try instantiate instance of spsite on farm server in custom process (myapp.exe) , give parameter whole uri ( http://mysite:80/ ). made sure account running myapp.exe site collection administrator . however, can't make instance of spsite whatever trying do. throws filenotfoundexception . anyone got idea? stacktrace: at microsoft.sharepoint.spsite..ctor(spfarm farm, uri requesturi, boolean contextsite, spusertoken usertoken) @ microsoft.sharepoint.spsite..ctor(string requesturl) @ mycompanyname.service.helperclass.getitemstateinsharepoint(sharepointitem item) in c:\workspaces\mycompanyname\development\main\mycompanyname.sharepoint\service\helperclass.cs:line 555 another side note... have web application + site collection can access through browser without problem. the filenotfoundexception thrown sharepoint when cannot find requested site collection in sharepoint configuration database. guess have not yet created site collection...

network programming - Bluetooth library for Windows -

where can find bluetooth api details windows xp, dlls etc pan connection etc. , regards, anjali "msdn bluetooth" on search engine: http://msdn.microsoft.com/en-us/library/aa362932(vs.85).aspx

keyboard shortcuts - Why does < C-a> (CTRL+A) not work under gvim on windows? -

i'm trying use < c-a> ( ctrl + a ) shorcut under vim increment variable under cursor. works fine under vim running on linux. when try in gvim under windows "selects all" (i.e. highlights or visually selects text in current window). how can change behaviour or alternatively how can recover increment variable functionality (e.g. perhaps different key mapping)? this because of mswin.vim sourced default _vimrc generated when install vim. override _vimrc .vimrc using under *nix, or delete mswin.vim.

networking - How to get a list of IP connected in same network (subnet) using Java -

how list of ip addresses devices connected same subnet using java? this should work when hosts on network react icmp packages (ping) (>jdk 5): public void checkhosts(string subnet){ int timeout=1000; (int i=1;i<255;i++){ string host=subnet + "." + i; if (inetaddress.getbyname(host).isreachable(timeout)){ system.out.println(host + " reachable"); } } } invoke method subnet (192.168.0.1-254) this: checkhosts("192.168.0"); didnt test should work kinda this. checks 254 hosts in last byte of ip address... check: http://download-llnw.oracle.com/javase/6/docs/api/java/net/inetaddress.html#isreachable%28int%29 http://blog.taragana.com/index.php/archive/how-to-do-icmp-ping-in-java-jdk-15-and-above/ hope helped

html - css layers ordering and arranging -

i trying have 1 one layer, , center images within. i.e., if have 3 images , want 3 links beneath them, there way without using separate div tag each link , image? automatically make links centered under images, , images spaced evenly within layer? i wondering how make div show behind standard html if possible. i.e. if have text , div on text, div default show on text, when behind. possible using layer? yes, you'll have put container element, such div, around each image , caption keep them together. <div class="picturebox"> <div> <img /> caption caption </div> <div> <img /> more caption </div> </div> -------- .picturebox div { text-align: center; /* whatever width/height/positioning want */ } for second part of question, regarding putting behind other text, take @ css z-index , though think applies absolutely positioned elements.

.net - Why does my custom HttpResponse throw exception on HttpResponse.End()? -

i'm writing code in need use own httpresponse object capture output method on object takes httpresponse parameter. problem is, other object (which cannot modify) calls httpresponse.end() , causes "object reference not set instance of object" exception thrown. can this? dim mystringbuilder new stringbuilder dim mystringwriter new io.stringwriter(mystringbuilder) dim myresponse new web.httpresponse(mystringwriter) someobject.dostuffwithhttpresponse(myresponse) ' calls myresponse.end() , crashes here's more complete information error, thrown following code in console application: dim mystringbuilder new stringbuilder dim mystringwriter new io.stringwriter(mystringbuilder) dim myresponse new web.httpresponse(mystringwriter) try myresponse.end() catch ex exception console.writeline(ex.tostring) end try here's text of exception: system.nullreferenceexception: object reference not set instance of object. @ system.web.httpresponse.end() ...

c - String search in a packet -

assume capture packets c api of libpcap. efficient parse payload strings string search strstr() in line speed (e.g. mbps/gbps)? example strstr(payload,"user-agent"); would more efficient regular expression pattern matching library, such libpcre? if want http header arguments, there c api? not clear me if libcurl can that... thank in advance. if searching single short string, nothing faster linear comparison used strstr() . said, strstr() 's special treatment of nul bytes not want examining network traffic, , better off writing own implementation treated bytes same , accepted length parameters. if you're searching multiple strings, you're better off using fast string-matching algorithm aho–corasick or building state machine matches strings want in context want—i.e., parser. parsing mostly-regular grammar http's in c, ragel state machine compiler tool of choice.

java - Auto generate data schema from JPA annotated entity classes -

i'm using jpa (hibernate's implementation) annotate entity classes persist relational database (mysql or sql server). there easy way auto generate database schema (table creation scripts) annotated classes? i'm still in prototyping phase , anticipate frequent schema changes. able specify , change data model annotated code. grails similar in generates database domain classes. you can use hbm2ddl hibernate. docs here .

Tabs, Text-Mate, Editing HTML (Rails) -

is there way force text-mate use two-space tab instead of full tab when editing html (rails) documents? yes. there's pop-up menu near bottom middle of window reads tabs: 4 or that. click on , hange 2 , soft tabs . you should have rhtml or erb document (or whatever file type want change) open editing when doing this. changes stick documents of type.