Posts

Showing posts from May, 2011

c# - How to use properties to expose a private array as read-only? -

what following code do? class myclass { private int[] myprivates; public int[] getmyprivates { { return myprivates; } } protected int[] setmyprivates { set { myprivates = value; } } } is there better way of protecting array myprivates ? possible make reat-only? you replace getters , setters property way: class myclass { public int[] myvalues { get; protected set; } public myclass() { myvalues = new [] {1, 2, 3, 4, 5}; } public void foo { foreach (int in myvalues) { trace.writeline(i.tostring()); } } } myotherclass { myclass myclass; // ... void bar { // can access myclass values in read outside of myclass, // because of public property, not in write because // of protected setter. foreach (int in myclass.myvalues) { trace.writeline(i.tostring()); } } } you can add pretty protection level less 1 o

c# - Display right datamember in the datagridview by using Bindinglist -

goal: display encapsulate field player problem: want display datamember_id , _name , _bust in class mainform using bindinglist was suppose use syntax [] above encapsulate field? class mainform datagridviewplayers.autogeneratecolumns=true; datagridviewplayers.autosizecolumnsmode=datagridviewautosizecolumnsmode.fill; bindingsourceplayers.clear(); bindingsourceplayers.datasource = _mygamemanager.players; class gamemanager: public bindinglist<player> players { { (int = 0; < _myplayergui_list.count; i++) { _player.add(new player(_myplayergui_list[i].player)); } return _player; } } using system; using system.collections.generic; using system.linq; using system.text; using cardgameclasslibrary; namespace cardgamelib { public class player { private int _id; private string _name; private hand _myhand;

NHibernate sub-collection using QueryOver -

i have simple classes: public class order { public int id {get;set;} public ilist<name> names{get;set;} } public class name { public int id {get;set;} public int langid {get;set;} public string localname {get;set;} } the quesetion how query subcollection of order have order.names.localname (something this): ilist<order> orders = repository.getbyproductlocalname("laptop"); i use new nh3 feature queryover, not using linq (i'v found solutions in of them uses linq). all need declare alias variable names collection , can use in clause... string localname = "laptop"; name namesalias = null; return session.queryover<order>() .joinalias(x => x.names, () => namesalias) .where(() => namesalias.localname == localname) .transformusing(transformers.distinctrootentity) .list<order>();

JavaScript syntax to find dates within last three years -

what proper syntax see if given date falls within 3 years todays date? need 3 years not take year of todays date , subtract 3 may not 3 full years ago. in other words if mid way through year. need go mid way through year 3 years ago. basically have records have dates attached them , want display them if between today , 3 years ago. thanks date objects can subtracted give difference in milliseconds: var = new date; var = new date(2008, 10, 7); if ((now - then) < 1000 * 60 * 60 * 24 * 365 * 3) 1000 * 60 * 60 * 24 * 365 * 3 3 years in milliseconds, discounting leap years , leap seconds.

c# - Problem with credential chaining sequence in Windows and .NET -

problem summary when run in batch mode, user identity lost (like cliffhanger) not until last moment. problem details i have powershell script running on winxpsp3 runs script block (via invoke-command) on remote machine particular test user (via -session parameter) in background (via -asjob parameter). session created this: new-pssession -computername $myserver -credential $mycredential the script block performs number of actions, culminating in running nunit test framework. c# code under test records "mytestuser" username (via environment.username ) credentials provided powershell received far. further confirmed process explorer: examining properties of nunit-console running batch tests shows owned mytestuser. the test includes accessing sql server 2008 r2 database; connection string set via new sqlconnection(connectionstring) call. connection string set windows authentication , uses form: data source=<my_db_server_name>;initial catalog=<my_db_name

Would be possible for Compiz to work on Windows? -

i don't think work is. more like, windows internal architecture allows third party sw integrate in between? read compiz, believe creates own window, , somehow mixes graphics system x own. still has catch events exit button , on. does windows allow this? let 3rd program scan input of window? , more, catching output of gui , replace it? does windows allow this? let 3rd program scan input of window? , more, catching output of gui , replace it? thanks. it possible. see windowblinds example. note windows "officially" not support this, applications windowblinds use api hooking, subclassing etc. perform deeds.

iphone - Finding and returning the distance between two coordinates -

i'm sort of newbie--please don't hate. the method compiles, i'm not sure how retrieve float value (i.e. distance between 2 points) method returns (or should return rather). -(float)finddistancebetween:(coordinate *)a and:(coordinate *)b { //distance formula: //sqrt( (x2 - x1)^2 + (y2 - y1)^2 ) float resultdistance; resultdistance = sqrt( pow((b.latitude - a.latitude), 2) + pow((b.longitude - a.longitude), 2)); return resultdistance; } //somewhere else... float thedistancebetween; //below incorrect: thedistancebetween = [finddistancebetween: location1 and: location2]; thanks is finddistancebetween:and: defined in @implementation block? code should like // in .h file @interface myclass : nsobject // declaration of method - (float)finddistanceinbetween:(coordinate *)a and:(coordinate *)b; @end // in .m file @implementation myclass // definition of method - (float)finddistancebetween:(coordinate *)a and:(coord

memory leaks - Windows 7, java 1.6.0_24 or 25m eclipse helios -->java.lang.OutOfMemoryError: PermGen space -

i have problem makes eclipse modeling helios sr2 xtext 1.0.2, crash on startup if have projects. if try update eclipse crashes. when building workspace crashes. an internal error occurred during: "workbench startup". java.lang.outofmemoryerror: permgen space !message internal error occurred during: "contacting software sites". java.lang.outofmemoryerror: permgen space i using windows 7, 64bits , jdk 1.6.0_25_b06 of 32bits , eclipse of 32 bits too. in 64 bits all, have more problems. i tried configuring eclipse .ini file haven't found correct parameters memory configuration. i need issue. thanks in advance. in eclipse.ini should find entries -xms40m or -xmx512m used tell virtual machine eclipse starts how memory may use. you may want use parameters like -xms64m -xmx512m -xx:maxpermsize=256m that way system can allocate 512 megabyte of memory alltogether eclpise , of 512 256 may used perm gen space.

python - numpy float: 10x slower than builtin in arithmetic operations? -

Image
i getting weird timings following code: import numpy np s = 0 in range(10000000): s += np.float64(1) # replace np.float32 , built-in float built-in float: 4.9 s float64: 10.5 s float32: 45.0 s why float64 twice slower float ? , why float32 5 times slower float64? is there way avoid penalty of using np.float64 , , have numpy functions return built-in float instead of float64 ? i found using numpy.float64 slower python's float, , numpy.float32 slower (even though i'm on 32-bit machine). numpy.float32 on 32-bit machine. therefore, every time use various numpy functions such numpy.random.uniform , convert result float32 (so further operations performed @ 32-bit precision). is there way set single variable somewhere in program or in command line, , make numpy functions return float32 instead of float64 ? edit #1: numpy.float64 10 times slower float in arithmetic calculations. it's bad converting float , before calculations makes program ru

jquery - How to include check -

i have function checks particular event , when detects displays overlay message. until happens need have beforeunload in place warn user potential data loss in case decide leave page before task complete. added in following manner, when task complete , beforeunload should not fire still gets triggered. think due bind . there way can implemented achieve trying accomplish? if (!$("#area").find('.item').length) { $("#message").dialog({ modal: true }); } else { $(window).bind("beforeunload", function() { return "are sure?"; }); } you need call unbind("beforeunload") remove handler.

wolfram mathematica - What is dollar sign $ used for internally? -

what symbol $ used internally? i not mean compound forms x$388 or $5 etc., $ itself. i wondering if valid object use in notation, or break if do. in version 7, symbol system`$ used created in fresh kernel, not used far know. in version 8, symbol $ not pre-created: in[1]:= context["$"] during evaluation of in[1]:= context::notfound: symbol $ not found. >> out[1]= context["$"] i agree szabolcs code using $ in system context might break in future versions, other code modifies system symbols.

c - Using fseek and ftell to determine the size of a file has a vulnerability? -

i've read posts show how use fseek , ftell determine size of file. file *fp; long file_size; char *buffer; fp = fopen("foo.bin", "r"); if (null == fp) { /* handle error */ } if (fseek(fp, 0 , seek_end) != 0) { /* handle error */ } file_size = ftell(fp); buffer = (char*)malloc(file_size); if (null == buffer){ /* handle error */ } i use technique ran link describes potential vulnerability. the link recommends using fstat instead. can comment on this? the link 1 of many nonsensical pieces of c coding advice cert. justification based on liberties c standard allows implementation take, not allowed posix , irrelevant in cases have fstat alternative. posix requires: that "b" modifier fopen have no effect, i.e. text , binary mode behave identically. means concern invoking ub on text files nonsense. that files have byte-resolution size set write operations , truncate operations. means concern random numbers of null bytes @

php - Variable in $_POST returns as string instead of array -

in form have fields name photoid[] when sent automatically in array when php accesses them. the script has been working fine quite time until couple days ago. , far can remember havent changed php settings in ini file , havent changed script @ all. when try retrieve array using $_post['photoid'] returns string contents 'array', if access using $_request['photoid'] returns correctly array. there php setting make occur? said dont remember changing php settings lately cause might mistaken, or there else missing. raise error_reporting level find potential source. it's using wrong in code. it's possible $_post array mangled, $_request left untouched. // example escaping feature might bork $_post = array_map("htmlentities", $_post); // case looks "strtoupper" to determine if $_post array contains string expected array, execute following @ beginning of script: var_dump($_post); and following comparison: var_dump

How to include socket.h in my c file in Ubuntu -

this a.c code : #include <stdio.h> #include <socket.h> int main(void) { int count[4] = {[2] = 3 }, i; (i = 0; < 4; i++) printf("count[%d]=%d\n", i, count[i]); return 0; } when compile it, shows: a.c:2: fatal error: socket.h: no such file or directory compilation terminated. so how include / can download it? it should be: #include <sys/socket.h> paths given relatively /usr/include path. e.g. socket.h file under /usr/include/sys/socket.h. can search if don't know: find /usr/include/ -name searched_header.h

.net - Any good Resources for WCF Delegation? -

i'm trying setup wcf delegation, without success (the scenario client > frontend server > backend server). in theory, should straight forward using kerberos (i have windows domain), in practice i'm running weird errors things sspi or basic message security. i found countless shallow resources, , forum posts people had problems , guessing solutions through trial , error. looked @ table of contents @ so-called "pro" , "expert" wcf books, delegation seems no 1 wants cover (in fact, there typo in 1 of exceptions .net throws makes me feel not microsoft bothers it). anyway, there resource has clue , confidence explain whole process a-z, using methodological approach actual explanations , not meaningless code blocks don't work , never explained? this more kerberos problem wcf problem. the basic idea client makes request under security context frontend server, security context sent on backend server. this cannot fixed in code. comput

asp.net - Is it possible to serialize the instance of the SqlDataSource into structured text, such as XML? -

i'm developing in-house asp.net application, due reason, i've create dynamic page dynamic created sqldatasource(s). so, i'm finding way serialize , persist sqldatasource instance(s) structured text(s) (e.g. xml), , later on de-serialize structured text(s), instantiate corresponding object(s) of sqldatasource. please kindly advise simplest way that. thank you! william simplest way serialize relevant properties (such connection string, selectcommand) - these way strings. de-serializing, create new sqldatasource , set these properties (or pass them via constructor).

css - Large White Space at bottom of website -

Image
every when i'm visiting website, notice there large white space @ bottom of site. if refresh page, white space disappears , normal. happening quite now, @ least once day when visit site. i have noticed on google chrome (for mac). problem may happen on other browsers, don't use other browsers often. here screenshot: note scroll bar ^ my site http://www.animefushigi.com try #master_wrapper{overflow:hidden!important;} in style sheet :)

css - Difference between margin and padding? -

Image
what difference between margin , padding in css? doesn't seem serve purpose. give me example of differences lie (and why important know difference)? padding space between content , border , whereas margin space outside border. here's image found quick google search, illustrates idea.

iphone - AVAudioPlayer memory leaks -

i have method in exterior class gets called whenever charachter in game hits wall (about once every 5 seconds on average). dont understand it. thaught on top of memory management. everytime method called, small amount of memory leaked (malloc 38 or 42 bytes) keeps happening, , game freezes up. here code: -(void)playboing { int x = (arc4random()%3)+1; nsstring *path = [nsstring stringwithformat:@"/boing_0%i.aif", x]; nsstring* resourcepath = [[nsbundle mainbundle] resourcepath]; resourcepath = [resourcepath stringbyappendingstring:path]; if (boing != nil) { boing = nil; boing.delegate = nil; [boing release]; } boing = [[avaudioplayer alloc] initwithcontentsofurl: [nsurl fileurlwithpath:resourcepath] error:nil]; boing.delegate = self; boing.volume = 1; [boing play]; } of course, it's lead memory leak first said, boing nil (but memory not deallocated, leaked), trying send release

Video playback problem in tab group activity of android? -

i have 4 tabs in application , play video in first tab using video view , @ same time if launch 3rd tab without stopping video in first tab , play video in 3rd tab inside video view , both different video view different id , in different activity, seems overlap video of first tab . i need close activity while user move out tab, how can done that.if knows means please me out. thanks. did try using ontabchangelistener. check this

c++ - interdependent classes in same namespace problem -

i'm in real fix... need port code, has lot of interdependent classes , uses namespaces in order avoid includes. works in msvc , can't find way deal situation in gcc :( contents of mystring.h file: #include "basebuffer.h" //i can't forward declare base class, have include header namespace test { class my_allocator { static const unsigned int limit = 4096; class mybuffer : public basebuffer<limit> { //... } }; template <class t, typename alloc = my_allocator> class mycontainer { //... } typedef mycontainer<char> mystring; } contents of basebuffer.h file: #include "myobject.h" //#include "mystring.h" //i can't include **mystring.h**, because includes header file , can't seem find way use forward declaration of **mystring** class... namespace test { template <uint limit> class basebuffer : public myobject { public:

rubygems - Ruby problem(bug)- in rake gem -

i running ruby 1.9.2p0 on rails on windows os rubymine 3.1.1. i use ×’several weeks. a few days ago- tried run project rubymine , console notification was: "could not find rake-0.8.7 in of sources process finished exit code 7" i googled , found reference problem in several places. solution repeated delete non-versioned "rake.gemspec" file. tried solution problem not resolved, still says same notification. i trying solve problem several days!!! please me if know how!!! thanks lot in advanced! asaf, i've had literally hours of frustration dealing similar problems. solution can challenge track down, because there numerous reasons having problem. i'm no expert myself, i'll try pass on of i've learned. first, mentioned getting error rake, didn't mention had tried run rake. getting error upon loading rubymine or after running rake command? next, if running rake command , getting error, should take note run command pretty imp

how to read google analytics api? -

ok lets have return like 0 => object(gapireportentry)[7] private 'metrics' => array 'pageviews' => int 1 'uniquepageviews' => int 1 private 'dimensions' => array 'visitcount' => string '61' (length=2) 'source' => string '(direct)' (length=8) 'city' => string 'jakarta' (length=7) 'pagepath' => string '/netcoid' (length=8) 'date' => string '20110511' (length=8) 1 => object(gapireportentry)[12] private 'metrics' => array 'pageviews' => int 1 'uniquepageviews' => int 1 private 'dimensions' => array 'visitcount' => string '68' (length=2) 'source' => string 'github.com' (length=10)

how to hide my custom data in image programatically c# -

please guide me how hide custom data in image. want generate image , hide custom data in image , read data image later. please need idea how it. you read format of bitmap image file, open bmp file, identify data starts , in data portion put data such each character represents pixel in image. talking bmp image because uncompressed format , easy read.

.net - Most advanced tutorial on custom collection editor -

Image
we need know on how customize standard .net collection editor, shall look? windows forms programming in c# chris sells how edit , persist collections collectioneditor

c++ - Where Should Shared Object Files Be Placed? -

i venturing land of creating c/c++ bindings python using pybindgen. i've followed steps outlined under "building ( gcc instructions )" create bindings sample files: http://packages.python.org/pybindgen/tutorial.html#a-simple-example running make produces .so file. if understand how .so files work, should able import classes in shared object python. however, i'm not sure place file , how let python know is. additionally, original c/c++ source files need accompany .so file? so far i've tried placing file in /usr/local/lib , adding path dyld_library_path .bash_profile. when try import module within python interpeter error thrown stating module can not found. so, question is: needs done generated .so file in order used python program? python looks .so modules in same directories searches python ones. have install normal python module either somewhere on python's sys.path default ( /usr/share/python/site-lib or that—it'd distribution-d

python - How to open A HTML page with windows-1252 encoding in beautifulsoup -

i try parse html document beautifulsoup run in troubles. best way open html document windows-1252 encoding? i tried iconv convert utf-8 doesn't work. doc = open("e.html").read() soup = beautifulsoup(doc) soup.findall('p') unicodeencodeerror: 'ascii' codec can't encode character u'\xfc' in position 103: ordinal not in range(128) when open without iconv same error. full traceback: >>> soup.findall('p') traceback (most recent call last): file "<stdin>", line 1, in <module> unicodeencodeerror: 'ascii' codec can't encode character u'\xfc' in position 103: ordinal not in range(128) try this: doc = open("e.html").read() doc = doc.decode('cp1252') soup = beautifulsoup(doc) soup.findall('p')

asp.net - Show and hide grid view selected rows particular cell -

currently i'm working on 1 project. there total 5 columns in grid in 2 visible false. name email_id_x email_id mobile_no_x mobile_no select -------------------------------------------------- --------------------------------- mahesh maxxxxxxahoo.co.in maheshsbhoye@yahoo.co.in 98xxxxxx96 986769696 select kiran kixxxxxx.in kiran@yahoo.co.in 93xxxxxx333 9333333333 select kiran kixxxxxx.in kiran@yahoo.co.in 93xxxxxx333 9333333333 select kiran kixxxxxx.in kiran@yahoo.co.in 93xxxxxx333 9333333333 select amit amxxxxxxin amit@yahoo.co.in 93xxxxxx333 9333333333 select so please tell me how hide column email_id , mobile_no. , when user click on select time can see selected rows email_id , mobile_no. thanks. first set visible=false 2 columns. row u have selected, change datasourceid , bind data in gridview1_selectedindexchanged event. first que

http - What endpoint do I hit for this Facebook API? -

http://developers.facebook.com/docs/authentication/permissions/ "user_online_presence" what endpoint hit? want know users online. just redirect user https://www.facebook.com/dialog/oauth?client_id=your_app_id&redirect_uri=your_url&scope=user_online_presence in documentation: http://developers.facebook.com/docs/authentication/

displaying newlines in the help message when using python's optparse -

i'm using optparse module option/argument parsing. backwards compatibility reasons, can't use argparse module. how can format epilog message newlines preserved? in below example, i'd epilog printed formatted. epi = \ """ examples usages: %prog -a -b foo else %prog -d -f -h bar """ parser = optparse.optionparser(epilog=epi) see first answer at: python optparse, how include additional info in usage output? the basic answer subclass optionparser class myparser(optparse.optionparser): def format_epilog(self, formatter): return self.epilog

Uploading a file in PHP -

i'm trying upload file using php. my folder structure following: i have directory called schemas in root htdocs folder. inside folder, want create new folder every user; in folder i'll storing user-specific files. for now, code incomplete (doesn't check whether or not folder/file exists , might error on this), i'm trying basics work. <?php if ($_files ["bestand"] ["error"] > 0) { //for error messages: see http://php.net/manual/en/features.fileupload.errors.php switch ($_files ["bestand"] ["error"]) { case 1 : $msg = "u mag maximaal 2mb opladen."; break; default : $msg = "sorry, uw upload kon niet worden verwerkt."; } } else { //check mime type - http://php.net/manual/en/function.finfo-open.php $allowedtypes = array ("application/pdf" ); $filename = $_files ["bestand"] ["tmp_name"]; $finfo = new finfo ( fileinfo_mime_type ); $fileinfo = $finfo->file ( $filename

javascript - GoogleMaps Overlay (floatPane) does not recive Click events -

what need configure receive click-events in googlemaps overlays? i have set minimal js-fiddle example here: http://jsfiddle.net/esbel/4/ i inherit own class google.maps.overlayview creates div , attaches maps floatpane. in example above clone div same site - click events work on template not in overlay-div... ideas? here other example found on net shows jqueryui overlay: http://fiddle.jshell.net/5kvy6/302/ , controls recive clicks normal... , dont find difference. edit: sofar have found gmaps creates overlay asynchronous, click handler link didnt attached, works $(..).live , still not able click button or enter text textbox; have updated example above. thx, daniel you forgot add click event copied content. adding code getpanes() works ... var panes = this.getpanes(); // yet exists // example $(this._div).click(function(){alert('here am');});

Weird method of adding CSS in a php file (using <<<CSS and CSS;)? -

i don't understand what's purpose of <<<css s , css; s in following code: $css_var = <<<css /*techozoic {$tech['ver']}*/ /*variable styles*/ #page{ background:{$tech_content_bg_color} url({$tech['content_bg_image']}) {$tech_content_bg_repeat} top left; } #header{ background-color:{$tech_content_bg_color}; } body{ font-family:{$tech['default_font']}, sans-serif; font-size: {$tech['body_font_size']}px; background:{$tech_bg_color} url({$tech['bg_image']}) {$tech_bg_repeat} top left; } .techozoic_font_size{ font-size: {$tech['body_font_size']}px; } .narrowcolumn .entry,.widecolumn .entry, .top { font-family:{$tech['body_font']}, sans-serif; } {$tech_post_bg_color_classes}{ background-color:{$tech_post_bg_color}; border-top:1px {$tech_acc_color} solid; } .top{ border:none; } h1{ font-family:{$tech_h1_font}, sans-serif; } h2{ font-family:{$tech_h2_font}, sans-serif; } h3{ font-family:{$tech_h3_font}, sa

analytics - Cross-domain user tracking without 3rd party cookies? -

how cross-domain web tracking services implemented (e.g., behavioral advertising ), majority of people browsing 3rd party cookies disabled? more explicitly, how third party tracking service recognize 2 requests different domains coming same person? some options come mind: maybe iframe-based , embedding tracking page third-party tracking service various sites. included tracking page should able set first party cookies tracking domain (?). if included page unique each tracked page, should possible match request website iframe embedded into?! ip + user agent based (unreliable) browser fingerprinting , clock skew measurements (i hope not in common use today) cookie handover , is, append session id paremeter links between various pages. visited page can set own cookie same id referring page. problem is, not work if second page not visited clicking 1 one of prepared links. using non-traditional cookies, such flash cookies . maybe of these monsters don't honor same-origi

java - Hibernate "not in" problem -

i trying create "not in" query using hibernate criteria. trying persons don't know language, have entity looks like: public class person { ... private list<language> languages; ... } public class language { public long id; public string label; } and criteria code looks like criteria cr = createcriteriaforperson() // created criteria cr.createcriteria("languages").add(restrictions.not(restrictions.in("id", values))); this returns persons including ones have language. if try search persons have know specific language, equivalent query returns correct results criteria cr = createcriteriaforperson() // created criteria cr.createcriteria("languages").add(restrictions.in("id", values)); what problem? thanks makis i'm pretty sure cannot express query in criteria api without using sqlrestriction . naive approach produces query this: select p person p join p.languages l l.

jquery - Why does this SetInterval code work for making Ajax requests? -

i have code: setinterval(sendajax('search', 'q'), 100 * 10); which thought work execute function sendajax(param,param) every 1 second. however, not case. executed function once. does know why occurs , solutions? regards, taylor i think have following: setinterval("sendajax('search', 'q')", 100 * 10);

cocoa - Designing views/windows in Mac OSX first time -

i tackle first mac osx project after developing ios. in ios applications, clear me whole navigationviewcontroller->myviewcontroller->myviews paradigm. a bit more background on ios app easier understand me: application sort of graphic viewer. once login have list of drawings, , if select one, opens up. in ios app have custom uiviewcontroller have menu ui , uiscrollview holds uiview in draw drawing. custom uiviewcontroller responsible acting "application" uiview inside merely graphic context. now - mac: thinking main window show drawings , once 1 selected, add window nsview graphic context of drawing, , window acting uiviewcontroller in ios app. does make sense? you can have nsviewcontroller or nswindowcontroller on mac, put controller logic in. if you're going separate windows, subclassing nswindowcontroller make sense.

module - Ruby/Rails: How to temporarily define what scope to call methods -

i have module: module liquidfilters include actionview::helpers::assettaghelper def stylesheet_tag(stylesheet_file_path) stylesheet_link_tag stylesheet_file_path end end and spec: describe liquidfilters describe "#stylesheet_tag" "should return css file in html (media=screen) tag" helper.stylesheet_tag("/path/css").should match(/<link href="\/path\/css\.css" media="screen" rel="stylesheet" type="text\/css"\s*\/>/) end end end but wrong number of arguments (2 1) error: failures: 1) liquidfilters#stylesheet_tag should return css file in html (media=screen) tag failure/error: helper.stylesheet_tag("/path/css").should match(/<link href="\/path\/css\.css" media="screen" rel="stylesheet" type="text\/css"\s*\/>/) wrong number of arguments (2 1) # ./app/filters/liquid_filters.rb:16:in `stylesheet_tag'

back up folder and always having 7 folders using ANT -

i have requirements ant script. my ant script checking out of "mobile" folder version control software "nightly build" folder , have requirements: if inside "nightly build" folder, there exist folder "mobile" folder, want older folder renaming folder "mobile" + timestamp "nightly build" folder should contain 7 such "mobile" folders only. means if there 8 "mobile" , need delete oldest "mobile" folder is possible in ant script(performed sequentially) , how do it? suggestion - deletes more 7 days old, rather keeping fixed number of builds. <property name="builds.dir" value="nightly build" /> <property name="build.dir" value="mobile" /> <tstamp> <format property="cutoff.7" offset="-7" unit="day" pattern="mm/dd/yyyy hh:mm aa"/> &l

scripting - Remove specific lines inside a range with sed -

i'm trying remove block inside pair of matching patterns using sed. given block like: <span class="fxlbc-t1-x-x-172">m<span class="small-caps">a</span><span class="small-caps">r</span><span class="small-caps">s</span></span> <span class="fxlbc-t1-x-x-248">r<span class="small-caps">a</span><span class="small-caps">i</span><span class="small-caps">s</span><span class="small-caps">o</span><span class="small-caps">n</span></span> i need remove block: <span class="fxlbc-t1-x-x-172">m<span class="small-caps">a</span><span class="small-caps">r</span><span class="small-caps">s</span>&

javascript - is there any way to parse date in string using Datejs? -

i came across datejs , found useful. not figure out if there way parse string , extract only date part using same. for example, if there string >> "i start exercise next monday." then should parse string, extract 'next monday' , convert date , give me result. how can implemented? thanks :) you can write regex that. easiest way. 'next' keyword in case. simple function can lookup current weekday , return date of next monday. should not complicated. edit: you can this: var pattern = /^([\w\w.]*)(next){1}([\sa-za-z]*)/; while (result = pattern.exec(yourtextvariable) != null){ // read data need result array } the pattern above expecting white space keyword next , red next word if has alpha-letters. (please note regex untested , may need refactoring fit needs. may take @ page this: javascriptkit.com )

css - Can I style an input button to be just a rectangle with a border? -

i style input buttons take away normal styling , make them rectangles rounded edges. i'm new css. can tell me if it's possible this. john yea, sure. input[type=submit], input[type=button], button { border: 1px solid #000; background: #f00; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } there go. http://jsfiddle.net/4fw4y/ example more bells , whistles: http://jsfiddle.net/4fw4y/1/ and yea, jeroen noted, fancier effects supported in modern browsers.

c++ - Is there any way the openldap allows us to set a DSCP (QOS(IP_TOS) in IP layer) values? -

my application uses openldap stack send request ldap server, want set dscp (ip_tos) values there way this? in advance sure, use setsockopt on ldap sockets: #include <sys/types.h> #include <sys/socket.h> int tos = iptos_lowdelay; if (setsockopt(sock, ipproto_ip, ip_tos, (char *) &tos, sizeof(tos)) < 0 ) { printf("failed setting tos on socket"); abort(); }

c++ - How to use a MFC dll in a Qt application -

i creating qt application , need use mfc dll in it! (i using vs2008) the qt application project properties are: configuration type: application use standard windows libraries this way, when try use mfc dll (during build): fatal error c1189: #error : building mfc application /md[d] (crt dll version) requires mfc shared dll version. please #define _afxdll or not use /md[d] if change mfc property use mfc in shared dll application builds, when try run it, get unhandled exception @ 0x78a5b48a (mfc90ud.dll) in myapplication.exe: 0xc0000005: access violation reading location 0x00000000. any ideas anyone? thanks! i guess problem qt-dll built version of c++ runtime libraries mfc-dll. using 2 dlls different runtimes causes crash when start program. i don't know if can rebuild qt sources, guess how solve this. need mfc library? perhaps there's way want.

ios provisioning - iphone: unable to deploy app on iphone -

i have downloaded certificate developer portal, downloaded provisioning profile organizer showing provisioning profiles have provisioning profile installed on device well but when trying change change developer profile getting error "the name (“common name”) of valid code-signing certificate in keychain within keychain path. missing or invalid certificate cause build error. [code_sign_identity]" problem has been fixed changing application's identifier '59r497cz5y.com.markmckie.ccna' 'com.markmckie.ccna' resource: error whilst compiling app

c++ - Making a GCC based Project Build and Run under Visual Studio 2010 -

i have been trying port c++ based mass data transport protocol project visual studio 2010 no success :( the code have been working on compatible win based systems..well mentor says :) have not been able make project build , run using existing *.h & *.cpp files under vs 2010. the project api under have 4 separate applications. hierarchy be: src folder- *.h , respective *.cpp files app folder- 4 applications (the api / library , *.h files available before linking such final dll file under src folder & main header file under app folder) i have makefile when project developed on linux platform have no idea how implement same on visual studio 2010 fyi: vs 2010 on compiling reports there missing header files such <cstdlib> , <unistd> best bet not real prob. prob. lies in way make project build itself. don't know should go making dynamic dll project main library , make 4 empty c++ projects inside 4 respective applications..? cheers, echo9 i

logging - How do I grant ASP.NET permissions to Write an Event Log entry -

i trying write application event log using eventlog.writeentry in system.diagnostics. i have no problem on local machine, on virtual server, blows security error. i tried default apppoolidentity, , under custom user created new apppool in iis_iusr group, without success. on advice, gave permissions in regedit app pool user hkey_local_machine\system\currentcontrolset\eventlog still no help. any ideas?

javascript - Jquery, User Interaction: Hover links to highlight project combinations -

js fiddle (code) this more of task have set myself learn arrays wondering if of can think of better cleaner way of doing task. want list of projects highlight when user hovers on links.. what want do i have list of projects, on each project have worked on seo, develpment or design. on page there list of links say: design, development , seo. when hovering on link want of projects highlight..(combinations). projects might of done more 1 task on highlight more 1 link..... how tried this i thought make 2d array list of on offs projects. depending on link hovered on pulls out correct array, if see jsfiddle link, far go. an example of similar id design thank anyhelp or advice i hope explained clearly, i know rip code off example link, rather learn doing cut , paste.. - see others think , use jquery. you can use 3 different styles each project , let : ".design", ".seo", ".development" $("#link1").hover( function ()

bitmap - ANDROID - MapView -

can 1 please me few things regarding mapview im trying build. have renderer takes canvas , draws bitmap in it. have created view , in constructor create: bitmap = bitmap.createbitmap(windowwidth, windowheight, bitmap.config.argb_8888); canvas = new canvas(bitmap); drawable = new bitmapdrawable(bitmap); drawable.setbounds(0, 0, drawable.getintrinsicwidth(), drawable.getintrinsicheight()); this.render(); in ondraw method have this: super.ondraw(canvas); canvas.save(); canvas.translate(mposx, mposy); canvas.scale(mscalefactor, mscalefactor); drawable.draw(canvas); canvas.restore(); now implement pan , zoom (currently im working without saved tiles) here ontouch: mscaledetector.ontouchevent(ev); final int action = ev.getaction(); switch (action & motionevent.action_mask) { case motionevent.action_down: { this.haspanned = false; final float x = ev.getx(); final float y = ev.gety(); mlasttouchx = x; mlasttouchy = y; mactivepointerid = ev.getpoint

perl - local::lib and notest for Makefile.PL -

i have makefile.pl want install dependencies "notest" flag , using local::lib home dir, can't grasp on makefile.pl options. my makefile.pl looks this: use inc::module::install; name 'myapp'; all_from 'lib/myapp.pm'; requires 'moose'; requires 'catalyst::runtime'; install_script glob('script/*.pl'); auto_install; writeall; i've noticed evalling local::lib (which installed) bash session turns on flags make dependencies install local::lib, i'm not sure , i've haven't tested yet: $ eval $(perl -mlocal::lib) $ perl -mlocal::lib export perl_local_lib_root="$perl_local_lib_root:/home/user/perl5"; export perl_mb_opt="--install_base /home/user/perl5"; export perl_mm_opt="install_base=/home/user/perl5"; export perl5lib="/home/user/perl5/lib/perl5/i686-linux:/home/user/perl5/lib/perl5:$perl5lib"; export path="/home/user/perl5/bin:$path"; but i'm not sure cha

c# - How to run the application continously without hanging in background -

have problem in running application continuously without hanging (appending data). want run code without hanging in background every 5 seconds. my code is: public void button1_click(system.object sender, system.eventargs e) { if (button1.text == "start") { timer1.interval = 5000; timer1.enabled = true; button1.text = "stop"; } else if (button1.text == "stop") { timer1.enabled = false; button1.text = "start"; } } or, can implement windows service, run in background of system without showing explicitly. in main thread can perform required actions 5 second delays.

php - graphviz svg autoresize -

i've got graph made graphviz circo (or dot , guess in issue there's no difference) in svg format , i'd image resized automaticly. know can done if set <svg width="100%" height="100%"... but can't realize how make circo this. the graph file circo generated in php this: $graph = "digraph structs { node [shape=record, url=\"http://localhost/gr.php?object=\n\"]; overlap = prism; size=\"50,50\";` i've tried size=\"100%,100%\"; circo translates <svg width="3600pt" height="2946pt" . so, how can make circo put 100% in there? thanks! the thing worked me is $svg = file('circo.svg'); $svg[6] = preg_replace("/\d+pt/","100%",$svg[6]); //the line number fixed foreach($svg $line) { echo "$line"; } maybe =)

linux - How do I output an inline transription of a hexdump to ACSII? -

here's example program called hexedit, show's mean inline: 3a40 - 31 65 33 38 00 00 00 00 00 00 00 00 00 00 00 00 - 1e38............ 3a50 - 00 00 00 00 00 00 00 00 00 00 0a 00 74 00 65 00 - ............t.e. 3a60 - 78 00 74 00 2f 00 61 00 73 00 63 00 69 00 69 00 - x.t./.a.s.c.i.i. 3a70 - 00 00 18 00 61 00 66 00 66 00 79 00 6d 00 65 00 - ....a.f.f.y.m.e 3a80 - 74 00 72 00 69 00 78 00 2d 00 61 00 72 00 72 00 - t.r.i.x.-.a.r.r 3a90 - 61 00 79 00 2d 00 62 00 61 00 72 00 63 00 6f 00 - a.y.-.b.a.r.c.o. 3aa0 - 64 00 65 00 00 00 64 00 40 00 35 00 32 00 30 00 - d.e...d.@.5.2.0. 3ab0 - 38 00 32 00 36 00 30 00 30 00 39 00 31 00 30 00 - 8.2.6.0.0.9.1.0. 3ac0 - 37 00 30 00 36 00 31 00 31 00 31 00 38 00 31 00 - 7.0.6.1.1.1.8.1. 3ad0 - 31 00 34 00 31 00 32 00 31 00 33 00 34 00 35 00 - 1.4.1.2.1.3.4.5. 3ae0 - 35 00 30 00 39 00 38 00 39 00 00 00 00 00 00 00 - 5.0.9.8.9....... 3af0 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - ................ 3b00 - 00 00 00 00 00 00 00 00 00 00 00 0

android - How to get a view from an activity, which is located inside a tab, while the view is located outside the tab -

i have layout inludes actionbar , tabs: <tabhost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> <linearlayout style="@style/backgroundlayer"> <!-- action bar buttons --> <include layout="@layout/incl_actionbar"/> <tabwidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content"/> <framelayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="5dp" /> </linearlayout> </tabhost> and on actionbar have several buttons need able access ac

ios - iPhone - quick Navigation bar question -

i have uinavigation bar in few of views without using uinavigationcontroller. dont use navigation controller push new views, load new views again have "static" uinavigationbar @ top. so navigation bars show title of ever view user looking at, have no other function. in of views have requirement have button, 3 views out of 10. so wondering if possible me insert button states , goes previous screen these 3 views, have able insert button , detect when pressed. can current set or need go , create view uinavigationcontroller , use push , pop views , somehow suppress button on 7 screens dont want display on? edit: i've tried following way: uibarbuttonitem *backbutton = [[uibarbuttonitem alloc] initwithtitle:@"back" style:uibackbuttonitemstyleborder target:nil action:selector(myaction)]; [navitem setbackbarbuttonitem:backbutton]; //doesn't work [navitem setleftbarbuttonitem:backbutton]; //works lacks arrow style of button [backbutton release]; s

iphone - Strange error using Core Data -

i have problem core data in application. there no situation when app crashes. random. @ time of crash i'm adding , modifying objects , saving nsmanageobjectcontext. know problem? #0 0x32668ebc in objc_msgsend #1 0x30494300 in -[nsknownkeysdictionary1 dealloc] #2 0x3049429c in -[nsknownkeysdictionary1 release] #3 0x304c76d2 in -[nsmanagedobject(_nsinternalmethods) _niloutreservedcurrenteventsnapshot__] #4 0x3049c31a in -[nsmanagedobjectcontext(_nsinternalchangeprocessing) _processrecentchanges:] #5 0x304d1bec in -[nsmanagedobjectcontext processpendingchanges] #6 0x304c4380 in _performrunloopaction #7 0x32d5c830 in __cfrunloopdoobservers #8 0x32da4346 in cfrunlooprunspecific #9 0x32da3c1e in cfrunloopruninmode #10 0x31bb9374 in gseventrunmodal #11 0x30bf3c30 in -[uiapplication _run] #12 0x30bf2230 in uiapplicationmain #13 0x0000e9a2 in main @ main.m:59 this looks on released object. try setting nszombieenabled environment variable yes before running app bet

pic - PICkit2 flashing led with Button -

i using pickit2 low pin count demo board 16f690 chip. have been able write simple code turn leds on , off, upon trying utilize push button change state of leds, have been unable so. code below, along link schematic device. #include <htc.h> __config(mclre_off & boren_off & pwrte_off & ieso_off & cp_off & fcmen_on); void main() { //initialization trisabits.ra3 = 1; //make button (ra3) input triscbits.rc0 = 0; //make led (rc0) output for(;;) // loop forever { //set rc0 if ra3 low (button pressed), else clear rc0 if(portabits.ra3) { rc0 = 1; } else { rc0 = 0; } } } demo board user’s guide ra3 /mclr, table 3 of datasheet says pullup on pin activated external /mclr configuration. if there no pullup, won't changes. pin read continously high or low? i'd avoid using ra3, @ least while debugging, , if have use

c# - How can I compare two unordered sequences (list and array) for equality? -

i have string array string str[] = {"a", "b"} and list<string> lst = new list<string> {"a", "b"} how can make sure both string array , list contains same values. note: values can in order must have same frequency. can tell me how in linq? thanks. okay, since order not matter frequncies do, need count each key, , check resulting pairs of keys/counts equal: var first = str.groupby(s => s) .todictionary(g => g.key, g => g.count()); var second = lst.groupby(s => s) .todictionary(g => g.key, g => g.count()); bool equals = first.orderby(kvp => kvp.key) .sequenceequals(second.orderby(kvp => kvp.key));

swig - Extending embedded Python in C++ - Design to interact with C++ instances -

there several packages out there in automating task of writing bindings between c\c++ , other languages. in case, i'd bind python, options such packages are: swig , boost.python , robin . it seems straight forward process use these packages create c\c++ linkable libraries (with static functions) , have higher language extended using them. however, situation have developed working system in c++ therefore plan embed python future development in python. it's not clear me how, , if @ possible, use these packages in helping extend embedded python in such way python code able interact various singleton instances running in system, , instantiate c++ classes , interact them. what i'm looking insight regarding design best fitted situation. boost.python lets lot of things right out of box, if use smart pointers. can inherit c++ classes in python, pass instances of c++ code , have still work. favorite resource on how various stuff (especially check out "

php - Pass through image from URL on dynamic script -

is possible pass through image file remote url, without downloading local server? i have php script tracks stats , outputs image via readfile(). example: <img src="http://example.com/image.php?img=1234"> i'd use cdn reduce load, , take advantage of geo-location services serve images faster. so, script needs output image straight cdn , not download local server output. any advice on how achieve this? possible? in advance! do tracking, send browser real location afterwards. see: http://php.net/manual/en/function.header.php <?php header("http/1.0 303 see other"); header("location: %the real uri%");

javascript - jQuery AJAX request on local development environment fail -

i'm trying test jquery/javascript script on local development environment. reason script calls error delegate. i've attempted make sure i'm not performing cross-domain request. $.ajax({ url: 'http://localhost', success: function(data, textstatus, jqxhr) { console.log('success'); console.log(data); }, error: function(jqxhr, textstatus, errorthrown) { console.log(textstatus); console.log(errorthrown); console.log(jqxhr); } }); return marker; } i'm running wamp stack. here output: error undefined xmlhttprequest { mozresponsearraybuffer=arraybuffer, status=0, more...} does know issue? try replacing absolute url: url: 'http://localhost' with relative one: url: '/' if doesn't solve problem firebug and/or fiddler give more hints going on , why ajax request f

path finding - Scent based pathfinding using C# in games -

was wondering if has knowledge on implementing pathfinding, using scent. stronger scent in nodes surrounding, way 'enemy' moves towards. thanks yes, did university final project on subject. one of applications of idea finding shortest path . idea 'scent', put it, decay on time. shortest path between 2 points have strongest scent. have @ paper . what did want know exactly??

reporting services - adding a blank row in the SSRS report -

i have groups in ssrs report , have set visibility false if there no values in group. want have 1 blank row group if empty.. there work around that.. instead of setting visibility on entire group, set visibility false on group detail , add additional group header or footer create blank row regardless of data visibility.

Mapping to different linked servers per database -

i have mssql server 2008 database "dblive" link 3 different external servers [extserver1, extserver2, extserver3], defined in sys.servers. there several stored procedures refer stored procs or tables on external servers, f.x. 'select top 1 @someid = id [extserver1].theextdb.dbo.sometable ...'. here challenge - if want put database on server - "dbtest" identical copy of "dblive" - should connect different external servers - how make [extserver1 .. 3] point different external servers "dblive" , "dbtest"? if cannot done - preferred way of linking external databases in such way 2 instances of same db, can have own external server references - without having differences in stored procedures? you'd want use synonyms here. see work around suggested in microsoft connect issue (and vote issue while you're there).