Posts

Showing posts from September, 2013

active directory - F# - how do I index a collection (specifically the PropertyCollection) -

i'm trying wrap mind around f# thought fun convert simple c# code have looks user in active directory using system.directoryservices namespace , returns directoryentry object. part i'm struggling indexing propertycollection contained in directoryentry. in c# once have directoryentry can @ properties in propertycollection doing this: entry.properties["displayname"].value i'm struggling how index collection in f#. can shed light on this? you need add . before brackets. entry.properties.["displayname"].value coming c++ / c# background found syntax bit odd @ first used it.

c++ - Segfault when calling a virtual function in another DLL -

i have two-part program main core needs have adapter registered , call register. parts in separate dlls, , core doesn't know adapter's specifics (besides methods , parameters ahead of time). i've tried setting following code , recieve segfault every time core tries call adapter method: core.hpp/cpp (combined , simplified) : class core { public: core() : madapter(null) { } void dostuff(int param) { if ( this->madapter ) { this->madapter->prepare(param); } } void register(adapter * adapter) { this->madapter = adapter; } private: adapter * madapter; }; adapter.hpp/cpp (in core library) : class adapter { public: adapter(core * core) { } virtual void prepare(int param) { // testing, defined here throw("non-overridden adapter function called."); } }; adapterspecific.hpp/cpp (second library) : class adapter_specific :

c# - Silverlight: Difficulty with binding to visiblity -

i have 2 elements: listbox , "this list empty" message. i'd bind visibility list box's itemssource being empty. however, i'm not sure how this: <textblock text="no favorite searches yet. add searching, clicking 'add favorites'" padding="10,0" verticalalignment="center" visibility="{binding path=favoritefilters.isempty, converter={staticresource visibilityconverter}}" /> <listbox itemssource="favoritefilters" x:name="favoritefilterslist" visibility="{binding path=favoritefilters.isempty, converter={staticresource visibilityconverter}}"> <listbox.itemtemplate> <datatemplate> <my:favoritefilterlink /> </datatemplate> </listbox.itemtemplate>

naming conventions - preserving units for calculations in programming -

i wondering if there sweet languages offer sort of abstraction "feet" vs "inches" or "cm" etc. considering doing following in java: u(56).feet() + u(26).inches() and able like 17.7292 meters result. one possible approach is, when making new value, convert "base" unit, meters or something, can add them easily. however, rather have ability preserve units, like u(799.95555).feet() - u(76).feet() returns 723.95555 feet and not 243.826452 meters - 23.1648 meters = 220.661652 meters //220.661652 meters feet returns 723.955551 feet since problem seems common, there framework or programming language exists handles elegantly? i suppose can add units in methods, adding matching units , converting in order +-*/ [add/subtract/multiply/divide] when requested, great adding , subtracting: //a { this.inches = 36.2; this.meters = 1; } //total length 1.91948 m if add object b values //b { this.inches = 0.8; t

arrays - Benefits of ArrayAccess Interface in PHP? -

implementing arrayaccess interface in php , can access object properties array keys . benefits of having object behave array? like see frameworks implementing 'form' arrayaccess interface , can access (html) form objects fields like, $form['namefield'] instead-of $form->namefield $form['titlefield'] instead-of $form->titlefield whats benefit of using $form['namefield] instead-of $form->namefield is speed of 'array data structures' or portability between object , array forms ? or missing something? :) there no functional benefit, structural. if define map, suggest, can contain arbitrary number of named elements, of similar kinds. object properties defined , of different types. in short: if implement arrayaccess "my object (also) behaves array". http://en.wikipedia.org/wiki/associative_array

android - Need to play audio to the caller -

for app need play pre recorded message caller. if calls phone , enable app should play audio such caller hears it. tried setting stream stream_dtmf,stream_voice_call ... (tried of them) nothing worked. stream_music made audio play through speaker not such caller hear ... tried searching around have not found answer yet ... appreciate if can respond ! this not directly possible on current android phones, outgoing call audio not pass through application processor on linux , android run.

asp.net - WebUserControl with file property -

i'm doing webusercontrol, , want add property show file list in desingview, property imageurl on image control, instead of images, property accept xml files. sorry english. i found solution, easy : ) [urlproperty] public string sourcefile { { //some code return ""; } set { //some code } } it's generate filename property

java - convert byte array to Base64 String in android -

so have user enter password signup android app. before save password database on server want convert md5 1 way hash , save database. messagedigest md = null; try { md = messagedigest.getinstance("md5"); } catch (nosuchalgorithmexception e3) { // todo auto-generated catch block e3.printstacktrace(); } try { md.update(password.getbytes("utf-8")); } catch (unsupportedencodingexception e3) { // todo auto-generated catch block e3.printstacktrace(); } byte raw[] = md.digest(); how convert byte array base64 string. saw in forum android util package left out base64 encoding , decoding on other hand see encodetostring function in android developers site. any appreciated. if want application compatible below api level 8, can pull in 3rd part library handle base64 encoding. apache commons codec 1 can try. includes base64 codec: http://commons.apache.org/codec/api-release/index

javascript - Check that value is object literal? -

i have value , want know if it's iteratable object literal, before iterate it. how do that? this should you: if( object.prototype.tostring.call( someobject ) === '[object object]' ) { // iteration } from ecmascript 5 section 8.6.2 if you're interested: the value of [[class]] internal property defined specification every kind of built-in object. value of [[class]] internal property of host object may string value except 1 of "arguments", "array", "boolean", "date", "error", "function", "json", "math", "number", "object", "regexp", , "string". value of [[class]] internal property used internally distinguish different kinds of objects. note specification not provide means program access value except through object.prototype.tostring (see 15.2.4.2).

How to configure a page to display while server is in planned maintenance in Jboss? -

how configure in jboss, when server in planned maintenance(not down), display error page? thanks. two possibilities: inside jboss: during time application, myapp.war, down, can deploy myapp.war single html/jsp file, displaying server under maintenance. see hello, world! web app example simple web app. if jboss runs behind webserver, such apache, can enable rewrite during maintenance: rewriteengine on rewriterule ^.*$ http://yourdoman.com/maintenance-info.html [l,r] we use second option because shutdown jboss instance.

php - moving a file to another server -

is possible copy file flash media server web server? can forsee if on same server possible via php if on 2 separate servers? depends on server. there some, support flash media streaming, red5 . i didn't use them much, it's hassle, of time. if want move file itself, you'd best doing file itself, php program. you might use other tools, scp or rsync , in case you're not against using external tools (this depends on os, of course.

System Analysis and design of A social Network -

is possible perform system analysis , design website ( particularly social network ) ? what expected contents , in document ? can u provide example , please ? { made social network (www.sy-stu.com) graduation project , want add full analysis study graduation document , have experience in uml , usecases idea of analysis of website not clear , never perform 1 before } thanx in advance this sounds ambitious, i'm sure it's possible. unfortunately, i've forgotten bit of system analysis, adhere many of guiding principles own projects. in fact, data-driven web sites excellent candidates systems analysis , should used during web planning project plan on putting production. straight wiki: the development of feasibility study, involving determining whether project economically, socially, technologically , organizationally feasible. conducting fact-finding measures, designed ascertain requirements of system's end-users. these typically span interviews,

asp.net mvc - Custom control for flickr is not works on the production server but it works on the development server -

we developed site named donmueang.com; site contains 2 custom controls named youtube control , flickr control. our problem 2 custom controls runs on development server flickr control not work on production server. what actual problem? i figured out. has flickr api tries store it's cache. default tries create directory , store file in logged in user's applicationdata folder. since production servers not grant access application folder, flickr api not load correctly. the fix me, since i'm using asp.net flickr api, add entry web.config file: <flickrnet cachelocation="e:\inetpub\[mywebappdirectory]\flickr_cache\"></flickrnet> hope helps.

Assign a remote for Git Push -

i've been developing in local repository while , set git server. in past, when remote repo exists, can git clone , , future git push works -- seems associated remote git clone retrieved. since want push existing work fresh remote, did git remote add foo . git push still doesn't work, have git push foo master . how can make foo master default git push works on it's own? , secondly, did approach in right way? how populate new remote repo existing local repo? if want git push push remote without additional parameters, rename remote foo origin .

css - Stop hyperlink inheriting div's width? -

hi have hyperlinks inside div display:block. problem hyperlinks length when clicked equal div's width. how make hyperlink's clicked length equal text of hyperlink without specifying width each link ? jsfiddle here use #links {clear:left;float:left} the float allow link sized, , clear prevent links being on same line. you may need add clear:left #links container depending on design. edit a little tutorial since asked: there 2 types of elements, inline , block. inline ones show in line no breaks. block elements take whole line , move next one. inline elements can't have width or height styled. blocks can. <a> inline element. setting display block, tell make new line every time. float gives elements inline behavior bump next eachother , flow on onto next line. float allows style width/height of element. it's sort of mix between two. the clear attribute stops inline floating , goes normal block behavior (new lines every time

cpu usage - High CPU utilization - VB.NET -

we facing issue vb.net listeners utilizes high cpu (50% 70%) in server machine running. listeners using threading concept , used filesystemwatcher class keep monitoring file renaming pointing 1 common location. both console applications , scheduled jobs running day. can please me out how control cpu utilization filesystemwatcher class? this depend on code running. for instance if have timer interval of 10ms work every 2 minutes , on each timer interval lot of checking take lot of cpu nothing. if using multiple threads , 1 looping waiting 2nd release lock (monitor.tryenter()) again may taking cpu. can avoid putting waiting thread monitor.wait() , when busy thread finished monitor.pulse(). apart general advise above, if post key parts of code or profile results may able more. if looking profiler use redgates ants profiler (costs free trial) , give results, haven't used other compare (and in no way affiliated redgate) others may better. hope of help.

windows - Question about Win32 ##Event## synchronization object -

first let me introduce application scene: i have service application spying status of something, while have multiple applications waiting status change. once status changed, each application read status value (via named filemap object) , execute corresponding actions, , wait status changed again. so used named event object synchronization work. applications waiting event signaled, , service application set event signaled when status changed. i need guarantee when status changed, each waiting application released , is released once ! i have tried these 2 methods method 1 create manual reset event; when status changed, first call setevent, call resetevent immediately. method 2 create manual reset event; when status changed, call pulseevent. both methods seem work during test. think neither of them reliable because: for ## method 1 ##, maybe of waiting threads won't chance executed before resetevent function called. for ## method 2 ##, microsoft has cl

upload - loading data from an excel to sql DB -

i have table data in sheet of xls. need 'update' data table in sql db. note: the xls contain columns undergo change. (for example if 2 columns undergo changes, 2 columns records present in xls) the primary key column present in xls reference. please me in solving this. if one-off load pretty easy turn data sql statements. sheet has 2 columns (a & b) put following formula in column c: "update tablename set somecol=" & b1 & " keycol=" & a1 (sorting out quotes strings, etc appropriate) next copy formula down bottom, copy cells in col c, paste text editor , run sql tool. if need hand on users or run there many, many ways , depends on tools @ disposal (java, c#, ...)

.net - How to calculate/profile percentage of parallelized C# Code -

greeting, i'm working on performance improvement application enabling multi-thread. learned " amdahl's law ", requires >50% of parallelized code achieve 2x speedup in 8 cores processor. hence wondering there tool in market provides parallelized code coverage or profiling can me improve performance? if you're using vs 2010, can use concurrency visualizer profiling multi-threaded apps.

mysql - tracking the slave lag -

i have master-master setup , noticed active master can handle several simultaneous queries @ time while slave reads 1 query @ time , takes lot of time catch up. 1) there solution this? 2) why slave shows 0 seconds "seconds_behind_maser". there times when shows correct number of seconds behind. in case, showing 0 seconds while still reading log. 3) why mmm_control shows both masters online while expected 1 master in "awaiting recovery" state. for master doesnt matter order simultanious updates/rollbacks/timeouts etc take place. whatever did resolve conflict right , clients given correct feedback. the slave must execute updates in same order master, way acheive run updates sequentially in order master commited them. not must single thread, can start work after master has commited. means when commit log record flushed disk, there actual physical io wait for.

multithreading - C++ Problem with creating thread using Bind -

i have little problem concerning thread , bind interaction. it simple, have situation class myclass { // ... // ... void dosome(); void doanother(myclass2, myclass3*); void run() { this->_myt = boost::shared_ptr<boost::thread>( new boost::thread(boost::bind(&myclass::dosome, this))); } // ... boost::shared_ptr<boost::thread> _myt; //... }; ok, till okay. understand bind able bind function or pointer function values, or better, argument values. when call on myclass object function run() new thread started. have question, why bind, in run, takes parameter this, when function dosome not use parameter? because there always, class functions, implicit argument pointer class??? ok, not problem. inside dosome, execution flow of first thread this: void myclass::dosome() { myclass2 m; myclass3* x = new myclass3; boost::shared_ptr<boost::thread>(new boost::thread( boost::bind(&myclass::doanother,

wordpress - How to show image when we post a comment? -

when post comment post or page in wordpress default shows gravatar image. don't want this. there way upload image when user posts comment in wordpress? need give people way upload own image when posting comment. those images not uploaded or set wordpress, service called gravatar sign service on blog using gravatar feature, image linked there site.

c++ - What exactly is an 'aligned pointer'? -

would please tell me aligned pointer means? it means address being pointed @ evenly divisible factor. sometimes term "natural alignment" used, means objects having natural alignment need placed @ addresses evenly divisble object's size. alignment somestimes important, since many hardware-related things place restrictions on such alignment. for instance, on classic sparc architecture (and on classical arm , think), can't read integer larger 1 byte odd address. trying halt program bus error. on x86 architecture, cpu hardware instead handles problem (by doing multiple accesses cache and/or memory needed), although might take longer. risc:ier architectures typically don't you. things these can affect padding, i.e. insertion of dummy data between e.g. structure fields in order maintain alignment. structure this: struct example { char initial; double coolness; }; would end having 7 bytes of padding between fields, make double field align

php - Drupal views filtering content by node id -

i have following scenario: i have content type called 'product' in there default input fields , number of custom input fields have been created using cck. when new product created, of data entered posted node (as normal). part of problem don't want values custom input fields within node content. therefore, thinking hide display of these fields. create block of custom input fields using views. is possible within views set filtering display values of custom input fields on node created? example if product created had node id of 1, possible filter view display values of custom input fields created node id of 1 , display these values block on node id 1? this might sound confusing approach keen separate of data entered product content type main node content, styling reasons. thanks, mark. ah worked out. it's easy solution isn't it? in arguments section of view, add node: node id. select action of 'provide default argument' , select 

Append to site <title> in Django template using block.super -

i have 3 django templates: base.html <title>{% block title %} site name {% endblock %}</title> default.html {% extends "base.html" %} {% block title %} {{ block.super }} - section name {% endblock %} main.html {% extends "default.html" %} {% block title %} {{ block.super }} {% endblock %} i'd site name in template main.html i.e. content of parent of parent block. {{ block.super.super }} is possible? i don't think possible. specific problem guess can solves if place site name before block, , use block append site name. otherwise define site_name in settings.py , have context processor like from django.conf import settings def site_name(request): return {'site_name': settings.site_name} so can use {{ site_name }} in templates - make sense because site name usefule @ other places too...

Catching Sql Exception In Entity Framework4?What is the best practice? -

what practices use in datalayer catch sql exceptions? has written generic sql exception handler catch common errors ? how do examples out there? thanks handle unexpected exception underlying layer only exceptions data layer (in case entity framework) should handled business layer. business layer can raise (if necessary) more high-level exception presentation layer (ui). don't throw , catch exceptions across more 1 layer of application. considered bad practice. presentation layer should handle business layer exceptions. never swallow exceptions using: try {} catch (exception) { // cares } catch expected exceptions possible always try handle expected exceptions (e.g. filenotfoundexception ) possible. if can handle it, handle directly there. if not, re-throw custom exception , handle in underlying layer. don't clear stack trace when re-throwing exception catch , re-throw implicitly (see) try {} catch (exception) { throw; } and not explicitly

iphone - Run shouldAutorotateToInterfaceOrientation from another method? -

how run following method - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation {} from method? (so new factors influence orientation) this method returns orientations allowed (portrait, portraitupsidedown, landscapeleft , landscaperight). calling method not class shouldn't change orientation dynamically. what trying achieve?

mysql - Online storage / sync of large iPhone user databases: perform on server or on device? -

i'm working on online user database backup / sync system popular sqlite-based iphone flashcard app; large-scale - pretty 100 million individual flashcard records or more (10,000 users, 10,000 cards each) - , need design system sort of scalability in mind. we're not in web-based software business, , @ least we're not planning give of web interface except account administration - of actual manipulation of user data occur offline. so seems have 2 basic options how implement this: perform sync on server; store users' data in mysql database (or bunch of them scale up) , download / upload lists of changes only. perform sync locally; download latest version of database server, check / apply changes on-device, upload merged database. it seems local sync option mean lot less programming work , lower hosting costs on our end, mean more bandwidth usage our users - on order of 2-4 mb each sync operation versus few dozen k web-based sync. does feel 1 of these options

c++ - dbgHelp new version -

want upgrade dbghelp version 5.1 6.11 (i heard 5.1 kind of buggy) downloaded "debugging tools windows" because that's dbghelp supposed when @ in directory ("c:\program files\microsoft sdks\windows\v7.0a\lib"), find dbghelp.lib. dll supposed be? :) oh... , how can know version of dbghelp if don't have dll? the installer copies top install directory, c:\program files\debugging tools windows (x86) on machine. same directory you'll find adplus.vbs , windbg.exe example. version bit older, 6.10

Html markup in cakephp's $html->link, eg. $html->link('<span>Hey</span>')? -

i have block of code in cakephp .ctp file: <h1> <?php echo $this->html->link('hello <span>stack overflow</span>', array('controller'=>'pages', 'action'=>'home')); ?> </h1> but instead of html being formatted, i'm seeing literally: <h1><a href="/rrweb/www/hub/pages/home"> hello &lt;span&gt;stack overflow&lt;/span&gt;</a></h1> any idea's? thanks! you need disable html entity conversion : echo $this->html->link( 'hello <span>stack overflow</span>', array('controller'=>'pages', 'action'=>'home'), array('escape' => false) );

How should I write my Google App Engine app.yaml file? -

i registered google app engine app , have files below: /index.html /css/index.css /js/index.js /feedbacks/index.html /feedbacks/css/index.css /feedbacks/js/index.js how should write app.yaml file? thank you! application: appname version: 1 runtime: python api_version: 1 handlers: - url: /favicon.ico static_files: img/favicon.ico upload: img/favicon.ico mime_type: image/x-icon - url: /css #your css folder static_dir: css - url: /scripts #your javascript folder static_dir: scripts - url: /img #your image folder static_dir: img - url: /.* script: your_script.py

php - Using Zend framework to redirect/forward (similar to 301 status) old URLs to new controllers/actions -

i have rather old website i've fed refactoring i'm rebuilding. the old urls don't have naming consistency me create sort of rule so, possible have sort of router/controller forwards ($this->_forward()) old urls new location? for instance when i'm calling http://www.example.com/this-is-a-url-with-a-random-name.php forward http://www.example.com/url/random-name ... maybe match exist in array key old url , value new location? or trying re-invent wheel , should stick ol' .htaccess rules 301 redirects? (i hope makes sense?) cheers, angel i'll start off recommending using apache config place rewrites if possible. it's faster both using .htaccess , zend framework application. i'll want use 301 redirects best search engines when content has been moved permanently. if want use zend framework application , if have bunch of urls may have different structures, best place in default error controller 'last ditch effort'. r

oracle - PL/SQL cursor select unique record and print in flat file -

i have set of values in cursor. example: cursor c_stock_option select empid, '1' isenrolled employee emp union select empid, '2' isenrolled employee emp; now want check if empid appears both in first select ( where isenrolled =1 ) , second select ( where isenrolled =2 ). want grab value first select where enroll=1 , reject 1 where enroll=2 . want print records qualifies criteria. for v_stock_option_record in c_stock_option loop if v_esppstock_recs in (v_stock_option_record.empid) end if; -- participant file. v_member_string_1 := v_stock_option_record.empid || g_delimiter || --1. participant id v_stock_option_record.last_name || g_delimiter || --4. last name v_stock_option_record.first_name || g_delimiter || --5. first name end loop; in first part of query selecting employees have purchased stocks (that give set of employees have purchased stocks, other part of query gives active employees in company, employee in first part of sele

What is the bulletin character in HTML? -

i want have bulletin characters in html page. not want use <ul> <li> or <ol> tags. can share character format should have bullet format. thanks if asking how bullet symbol, take here: http://natural-innovations.com/wa/doc-charset.html using &bull; should it.

php - Script to Mail web page to a friends Email -

i need php script can use set online newsletter , have link allow visitors email web page newsletter elses email... is possible? suppose is, done here. need. want set newsletter, add script allow visitor send newsletter directly friends inbox. http://www.pretoria.co.za/interactive/forward-newsletter.html i suppose need script send html file email address please - thank you that can written using 1 of email wrapper scripts, such phpmailer. however, when doing so, pay particular attention issues lead spam , other abuse of form. should spend time lock down client-side, server-side validation on input variables. that being said, best way save html of page in database, , pull out body of email. should include text-only version alternate body people without html email able read it. then, when submits form, validate data, put message methods available mailer class choose, send email, , redirect "thank you" page.

iphone - NSDate best practice in creating a date with no time element -

i writing app uses core-data store data. included in date field of interested in date not time. need select records based on date (not time) , have created category on nsdate return date, normalised set time follows: + (nsdate *)datewithnotime:(nsdate *)datetime { if( datetime == nil ) { datetime = [nsdate date]; } nsdatecomponents* comps = [[nscalendar currentcalendar] components:nsyearcalendarunit|nsmonthcalendarunit|nsdaycalendarunit fromdate:datetime]; nsdate *dateonly = [[nscalendar currentcalendar] datefromcomponents:comps]; [dateonly datebyaddingtimeinterval:(60.0 * 60.0 * 12.0)]; // push middle of day. return dateonly; } i use when add data core-data store (i have setter uses method set primitive date value) , use method create date use compare dates when performing fetch request. in theory should work - ie pick out dates i'm looking for. i'm nervous though i'm not totally sure effect changing time-zone or locale have. still work ? what c

javascript - How to change flashvarsObj -

i can set flashvarsobj on initialization (swfobject.embedswf) , don't know how change flashvarsobj after initialization when access swfobject.getobjectbyid. i have flash graph , need reload new parameters. flashvars passed @ moment file embedded. if need pass new vars, must either delete re-embed entire swf, or modify swf use externalinterface passing data via javascript.

What exactly does this mean in C#? -

i'm browsing open source .net twain wrapper , saw this: [flags] internal enum twdg : short { // dg_..... control = 0x0001, image = 0x0002, audio = 0x0004 } what 'flag' decorator mean? (is called 'decorator'?) also, short mean @ end of enum declaration? thanks! short keyword system.int16, two-byte integer ranging -32,768 32,767. default, enum's base type int; in case, they're attempting use smaller data type store enumerator values.

asp.net - How to retrieve value from sqldatasource1 to textbox1 using vb.net? -

how retrieve value sqldatasource1 textbox1 using vb.net ? i have table field employee id : 1001 i wannna retrive top1 employee id in textbox1 using sqldatasource1 something may help: dataview odataview = new dataview(); odataview = sqldatasource1.select(datasourceselectarguments.empty); datarowview dr = odataview[0]; textbox1.text = dr["employeeid"].tostring(); i have not tested code though. you may want read followings more info on sqldatasource: http://quickstarts.asp.net/quickstartv20/aspnet/doc/ctrlref/data/sqldatasource.aspx http://www.aspfree.com/c/a/asp.net/programming-the-aspnet-20-sqldatasource-control/ http://www.defaultdotaspx.com/answer.aspx?questiontype=aspnet&questionid=149 http://www.mikesdotnetting.com/article/64/bind-data-from-a-sqldatasource-to-a-label hope helps!

ajax - Exclude non minified java script from release build -

i have .net library provides ajax controls. library build visual studio 2008. ajax minifier task used auto generate minified javascript files. in debug build need original javascript files debugging javascript, in release build these have no usage. what recommend? ignore them in release , let them blow file size? there penality in loading time? or remove them release build? how? modify project file , add condition attribute. not integrate in visual studio. edit: to clearify: primary question is: arguments including , excluding non minified files. update: just found solution nice solution auto exclusion. hers part of project file: <itemgroup> <embeddedjavascript include="myjavascript.debug.js" /> <embeddedresource include="myjavascript.js" /> </itemgroup> <import project="$(msbuildextensionspath)\microsoft\microsoftajax\ajaxmin.tasks" /> <target name="beforebuild"> <itemgroup condition=&

javascript - Vertical Text Scroller jQuery -

i'm searching jquery plugin can scroll text in container div can't find it. suggest something? thanks in advance!! maybe work simplyscroll

c# - How can I create an open Delegate from a struct's instance method? -

i have struct private method i'd invoke. since plan in performance critical section, i'd cache delegate perform action. problem can't seem bind method delegate.createdelegate. struct in question not creation , used in interaction third party library. struct in question looks this:: public struct { private int somemethod() { //body go here } } and following code fail "error binding target method". delegate.createdelegate(typeof(func<a,int>),typeof(a).getmethod("somemethod",bindingflags.instance | bindingflags.nonpublic)); i know can write expression tree perform action, seems odd can't use normal goto these things delegate.createdelegate method. the above code works fine if a class. issue arises because a struct. msdn documentation incorrect overload of createdelegate work on non-static methods. interesting problem. bug report, looks might bug fixed in future version of .net: http://connect.mic

accessibility - Is there a segment of users who have flash enabled but javascript disabled? -

when making websites accessible, assume if doesn't have javascript, don't have flash either. true, or there group of users don't have javascript still benefit flash embedded directly page? i realise it's technically possible, find out whether there meaningful quantity of users in situation. sure segment of users such configuration, suppose small. user afraid lots privacy disable javascript. these users never install flash if aren't forced so.

php - About the mysql_query -> mysql_fetch_array() procedure -

sample code: $infoarray = array(); require_once("connectandselect.php"); // connects mysql , selects appropriate database $sql = "some sql"; if($results = mysql_query($sql)) { while($result = mysql_fetch_array($results, mysql_assoc)) { $infoarray[] = $result; } } else { // handle error } echo("<pre>"); print_r($infoarray); echo("</pre>"); in sample code, want result of query in $infoarray. simple task, simple measures... not. have enjoyed this: $sql = "some sql"; $infoarray = mysql_results($sql); but no, can see, have 2 variables , while loop don't care much. don't anything: i'll never use them again. furthermore, never know how call them. here use $results , $result, kind of represents are, can quite confusing since alike. here questions: is there simpler method don't know kind of task? and if not, names give one-use variables? there standard? the while loop

ssl - Redirecting wildcard subdomains to a different top-level domain with nginx -

we have bunch of wildcard subdomains (_foo.example.com, bar.example.com, etc) that, when accessed via https should redirect equivalent subdomain on our secure domain. some examples: https://foo.example.com => https://foo.secure.com https://foo.example.com/some/path => https://bar.secure.com/some/path https://bar.example.com => https://bar.secure.com i think can accomplished nginx rewrites i'm not sure syntax. here's i'm attempting: server { listen 443; server_name *.example.com; rewrite ^(.*) https://*.secure.com$1 permanent; } this won't work because i'm not capturing incoming subdomain , using in rewrite. try (untested): server { listen 80; listen 443 default ssl; server_name "~^(?<name>\w\d+)\.example\.com$"; rewrite ^(.*) https://$name.secure.com$1 permanent; }

Am I not escaping this JavaScript HTML correctly? -

why javascript not getting rendered correctly when outputted html? var innerhtml = "<div style='color:yellow;font: 14px//14px /'lucida grande/',sans-serif;'>"; am not escaping correctly? / should \ var innerhtml = "<div style=\"color:yellow;font: 14px/14px 'lucida grande',sans-serif;\">"

c# - Canceling javascript requests in IE -

does know how handle , cancel javascript requests in ie? basically, i'm interested in such functionality c# webbrowser control. goal here handle javascript/ajax requests internet , if request's url match filter cancel it. think of sort if ads blocker. solution fine because think able use somehow in project. or maybe know how other browser/wrapper? appreciate help. if referring ajax calls depends how make call. if make call using jquery example example of how cancel here: abort ajax requests using jquery if make call directly using , xmlhttprequest object see abort method here: http://msdn.microsoft.com/en-us/library/ms535874(vs.85).aspx so call relevant kill/abort method, , handler or error callbacks have attached ajax call should never called. if want block ajax calls in webbrowser control there seems way, it's bit messy. see later part of discussion: http://social.msdn.microsoft.com/forums/en/winforms/thread/c7c9a6f9-9875-4d8b-8c87-81f2c423fa6a

Eclipse workspace & active sets -

i prefer have 1 workspace , put projects 1 work space instead of making multiple workspaces organize projects. use active sets organize clutter in project explorer. way set workspace preferences once. typically projects dynamic web projects setting 1 server me more efficient having multiple workspaces. but found unless close project before moving out of active set, problems view still shows entries projects not in active set. there configuration setting modify behavior? edit: ok learned windows working sets link http://blog.empiregpservices.com/post.cfm/eclipse-window-working-sets . can change, edit or create new working sets 1 interface , views obey choice. , nanda points out below can configure contents of problems view using down arrow view menu . choose scope windows working set voila! views can in sync! you can configure problem view show error active sets. see toolbar on upper right of view.

mono - Moq: Verifying a method was called with a particular delegate produces "method argument length mismatch" -

i've got class a calls method on interface b , passing 1 of own methods sort of continuation b supposed call when has result. code seems work fine in practice, can't figure out how test moq -- when try obvious thing, produces system.argumentexception : method argument length mismatch . thought @ first might code, fails same way following toy case: public class { readonly b myb; public (b b) { myb = b; } public void handlec (c c) { // } public void dofindc () { myb.findc (handlec); } } public interface b { // finds c , passes handlec void findc (action<c> handlec); } public interface c { } [testfixture()] public class atest { [test()] public void testdofindc () { mock<b> bmock = new mock<b> (); a = new a(bmock.object); a.dofindc(); bmock.verify(b => b.findc(a.handlec)); } } i'm guessing there's behind-the-scenes mag

winforms - Get Rid Of Customize Layout Context Menu DevExpress -

when right click in blank space in usercontrols or devepress forms context menu comes allowing me customize form how diable this?????? i working on windows application in datacontrols property window set allowcustomizationmenu = false on datacontrols on form

java - Do you use a solution for all server related stuff (Git repositories, mail, database, web services) or many solutions? -

i solve problems domain place can store git repositories place can deploy java, (python, php) applications place have jabber, mail, silc on own domain i don't have enough technical knowledge run own server, use else solution cheap possible. there cloud solution these capabilities? there trustful, cheap server provider? or use many solutions - gmail, github, aws/gae, etc? finding need in 1 place unlikely. typically use google apps email , docs (they support jabber), use other services github git hosting needed. deployment varies project, includes appengine , heroku , slicehost , or ec2 . i'd advise familiar few services , try them out. if experience mine, settle on services (and can afford).

iphone - Split an NSString -

quick question. need split nsstring, if contains substring. can show me example of how this? // string string = result: 123.23 // bad string (has no result prefix) string = asldkfjasdlkfj if( string has "result: " in ) { string2 = (something returns 123.23 part) } thanks much! alright then, 2 quick methods: -[nsstring hasprefix:] -[nsstring substringfromindex:] however don't forget handle invalid cases.

jQuery plugin that suggests/autocompletes within a textarea -

Image
is there jquery plugin suggests/autocompletes within textarea? what want have suggested words or autocompleted text proffered user in textarea example image below: well there autocomplete plugin that, , if want pull data database recomment using ajax api included in jquery. something this $('textarea').keyup(function(){ $.post('ajax/test.php', function(data) { $('#example').autocomplete(data); }); }); also remember basic structure give idea. p.s. found this should fill needs.

asp.net mvc - MVC - Creating a Castle Windsor Controller Factory - No parameterless constructor defined for this object -

i introducing di ms mvc application , having trouble getting controllers instantiated within custom controller factory. seems overridden "getcontrollerinstance" not being called. can tell me missing? my controller factory: public class windsorcontrollerfactory : defaultcontrollerfactory { public windsorcontrollerfactory() { var controllertypes = t in appdomain.currentdomain.getassemblies().selectmany(a => a.gettypes()) typeof (icontroller).isassignablefrom(t) select t; foreach (type controllertype in controllertypes) { applicationcontainer.container.addcomponentlifestyle(controllertype.fullname, controllertype, lifestyletype.transient); } } protected override icontroller getcontrollerinstance(system.web.routing.requestcontext requestcontext, type controllertype) { if(

java - dis.readchar Chinese letters - wrongly interpreted Characters! -

i want read file arraylist of characters. @ first thought might pretty slick way doing it: arraylist<character> char_chain = new arraylist<character>(); try { fis = new fileinputstream(file); bis = new bufferedinputstream(fis); dis = new datainputstream(bis); while (dis.available() != 0) { // utf8 unnoetig, da 26 lettern while (!eof) { try { char_chain.add(dis.readchar()); } catch (eofexception e) { eof = true; } } } if (debug) { while (char_chain.get(i) instanceof character) { system.out.println(char_chain.get(i++)); } } if chinese letters: 噖 䝃 塘 䕅 could tell me why is? :) should mention text contains regular upper-case letters like: abcde , on. datainputstream.readchar() assumes r

java - Wicket TextField with default value -

what elegant way create textfield in wicket rendered default value besides manually setting "value" attribute of component using simpleattributemodifier? for instance, works: textfield<string> headline = new textfield<string>("headline", new propertymodel(backingobject, "headline")); headline.add(new simpleattributemodifier("value", "default value")); add(headline); but there better way? propertymodel works both ways. instead of using attribute modifier, change headline so: backingobject.setheadline("[desired initial text]"); you can anywhere, doesn't have after textfield declaration. of course, if don't want touch backingobject beforehand, won't work, i'm going assume that's not issue since didn't mention it.

php - facebook username validation regex pattern -

i need regex pattern validate if string valid facebook username? according this site ... preg_match('/^[a-z\d.]{5,}$/i', $username);

java - WebDriver: executeScript() causes BindException -

javascripthere script found @ javascript: how text nodes following/preceding break tags , wrap them ddb tag? while running ((javascriptexecutor)driver).executescript(javascripthere) on each page loaded via webdriver, i following error after test runs 3 minutes: exception in thread "main" org.openqa.selenium.webdriverexception: java.net.bindexception: address in use: connect system info: os.name: 'windows xp', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_18' driver info: driver.version: remote @ org.openqa.selenium.remote.remotewebdriver.execute(remotewebdriver.java: 341) @ org.openqa.selenium.firefox.firefoxdriver.execute(firefoxdriver.java: 234) @ org.openqa.selenium.remote.remotewebdriver.findelements(remotewebdriver.java: 173) @ org.openqa.selenium.remote.remotewebdriver.findelementsbyxpath(remotewebdriver.java: 231) @ org.openqa.selenium.by$6.findelements(by.java:200) @

drupal-----add a field to the content type story -

now, want add dead time field(the style 02-12-2010) content type story. how that, used hook_form_alter() , format_date(),but when created new article,and select time.but time can't show on article's page.why? why don't try contributed modules instead? a more elegant solution think using cck module provides ability of adding new fields content types (as creating new content types), can install date module provides ability attach date fields content types.

Erlang sample project in erlide (eclipse) -

guys, started learning erlang ... , since i'm java programmer, i'm using eclipse ... downloaded erlide ... looking tutorial in net on how use erlide create simple erlang project. knows it? in advance. bromo not erlide specific, used otp project structure , intricacies: http://20bits.com/articles/erlang-a-generic-server-tutorial/

android - Need touch tutorial -

i new android please if sound stupid, not reply. hello, have tried searching on net tutorial me understand how android takes touch events , reacts accordingly. have not been successful. if knows tutorial me, please post here. helpful. this tutorial bit long, takes through start-to-finish creating simple app handles touch events. liked , hope helps: http://www.kellbot.com/2009/06/android-hello-circle/

Why is this code returning different values? ( C# and VB.NET ) -

vb.net code: module module1 sub main() dim x, y single x = 0 + (512 / 2 - 407) / 256 * 192 * -1 y = 0 + (512 / 2 - 474) / 256 * 192 console.writeline(x.tostring + ": " + y.tostring) console.readline() end sub end module returns: 113,25: -163,5 c# code: class program { static void main(string[] args) { float x, y; x = 0 + (512 / 2 - 407) / 256 * 192 * -1; y = 0 + (512 / 2 - 474) / 256 * 192; console.writeline(x + ": " + y); console.readline(); } } returns 0: 0 i don't it, appreciate explanation. c# / performs integer division, truncating fractional portion. vb.net implicitly casts double . to perform floating point division, cast floating point type: static void main(string[] args) { float x, y; x = 0 + (512 / 2 - 407) / (float)256 * 192 * -1; y = 0 + (512 / 2 - 474) / (float)256 * 192; console.writeline(x + ": &quo

python - updating values of class attributes -

i have class following: class myclass(object): def __init__(self, input1, input2): self.attribute1 = [(a1_d1, a1_p1), (a1_d2, a1_p2)] self.attribute2 = [(a2_d1, a2_p1), (a2_d2, a2_p2), ..., (a2_d10, a2_p10)] ...some other attributes here... the first coordinate in every pair decision/action , second coordinate probability action chosen. want write function updates these probabilities instance of class program runs. way probabilities updated depends on decision taken previously. example, can write functions of following sort: def update_probabilities_attribute1(self, decision): = 0 action, current_probability in self.attribute1: code here self.attribute1[i] = (action, new_probability) = + 1 def update_probabilities_attribute2(self, decision): = 0 action, current_probability in self.attribute2: code here self.attribute1[i] = (action, new_probabili

apache - mod_rewrite of from example.com/ to example.com/home/ for certain user-agent -

i know should simple. can't right. following, can redirect example.com/abc example.com/home/abc not example.com/ example.com/home rewritecond %{http_user_agent} ^.*chrome.* rewriterule ^([^/]+)/?$ home/$1 how can redirect / well? if want redirect everything chrome under home/ subdirectory, try following, match or nothing, , append after home/ rewritecond %{http_user_agent} ^.*chrome.* rewriterule ^(.*)$ home/$1

Java Regex Engine Crashing -

regex pattern - ([^=](\\s*[\\w-.]*)*$) test string - paginationinput.entriesperpage=5 java regex engine crashing / taking ages (> 2mins) finding match. not case following test inputs: paginationinput=5 paginationinput.entries=5 my requirement hold of string on right-hand side of = , replace something. above pattern doing fine except input mentioned above. i want understand why error , how can optimize regex requirement avoid other peculiar cases. you can use behind make sure string starts @ character after = : (?<=\\=)([\\s\\w\\-.]*)$ as why crashing, it's second * around group. i'm not sure why need that, since sounds asking : a single character, equals then 0 or more repeats of following group: any amount of white space then amount of word characters, dash, or dot end of string anyway, take out * , , doesn't spin forever anymore, i'd still go more specific regex using behind. also, don't know how using this, why

How can I set a VIM filetype programmatically? -

is there way set vim filetype programmatically, instead of doing this: au bufnewfile,bufread *.dump set filetype=sql i can this let g:temp_file_type = 'sql' au bufnewfile,bufread *.dump set filetype= g:temp_file_type you can set options let prefixing option name & . eg: let &filetype=g:temp_file_type

android - Reuse inflated views -

i building complex view based on dynamic data. depending on number of data elements in collections adding more views. each of these subviews complex , inflated in loop through data collection. this of course inefficient , figure out way inflate subview once , reusing them instead. possible somehow? ps: not want build subviews in code (i know could) because make things messier due complexities , number of subviews, if performance increase considerably might take @ that. pps: there no visible performance problem traceview of time spent inflating , if can make faster love ;-) you can check out google io session entitled 'the world of listview'. it explains nicely how prevent inflating same view again , again, , how reuse particular view if has been inflated earlier. here link. http://www.google.com/events/io/2010/sessions/world-of-listview-android.html you can either download .pdf file or view video. hope helps. regards, mahendra liya.

php - Zend_Lucene and wilcard operator weirdness -

a quick summary of problem, wildcard operator doesn't seem return result expecting. testing against keyword field. here come sample showing issue include 'zend/loader/autoloader.php'; $autoloader = zend_loader_autoloader::getinstance(); $autoloader->setfallbackautoloader(true); zend_search_lucene_analysis_analyzer::setdefault( new zend_search_lucene_analysis_analyzer_common_utf8_caseinsensitive()); @mkdir('/tmp/test-lucene'); $index = zend_search_lucene::create('/tmp/test-lucene'); $doc = new zend_search_lucene_document(); $doc->addfield(zend_search_lucene_field::keyword('path', 'root/1/2/3')); $doc->addfield(zend_search_lucene_field::unstored('contents', 'the lazy fox jump on dog bla bla bla')); $index->adddocument($doc); $doc = new zend_search_lucene_document(); $doc->addfield(zend_search_lucene_field::keyword('path', 'root/1')); $doc->addfield(zend_search_lucene_field::unst

ruby - Error installing rubygems -

i following error when trying install rubygems version 1.3.7 ~/downloads/rubygems-1.3.7 $ ruby setup.rb error: while executing gem ... (errno::eacces) permission denied - /system/library/frameworks/ruby.framework/versions/1.8/usr/bin/gem any idea cause this. i've installed rvm. thanks run command sudo !!

MySQL Replication and Master server crash recovery -

scenario: we have mysql master db [30 gb] 5 slaves[partial] being used different purposes. last day innodb crashed. auto crash recovery did not work on every write operation server getting crashed again. started server innodb_force_recovery 4 , took dump of whole db , restored new database server. whole process took me on 5 hours data restoration slow. question: now looking solution in recovery time quickest. can have server in replication master not sure how replace in place of master in case of master crashes. thank time , help. good read percona: improving innodb recovery time

Display nested field groups in a custom content type in Drupal -

is possible have nested groups in custom content type in drupal? want achieve following in 'manage fields' page: + tab group 1 + field_some_text_1 + field_some_text_2 + standard group 1 + field_some_text_3 + field_some_text_4 + field_some_text_5 + standard group 2 + field_some_text_6 + field_some_text_7 + tab group 2 + etc... the tab groups ideally contain other standard groups make css based layout little easier. some discussions around exist on drupal forums (see example here , here , here ). does know if doable in drupal? on drupal core 6.19 , cck 6.x-2.8. i've wanted similar, unfortunately, can tell of discussions going on, it's not possible right now. way field groups structured, require quite re-write of functionality, , no 1 has taken task yet. so... sorry. (i love have though!)

c# - Force a WebBrowser to receive MouseWheel events? -

i have webbrowser behind transparent panel transparent panel handles clicks, want webbrowser receive mousewheel events. possible programmatically? i've tried setting activecontrol webbrowser , calling webbrowser.select() , webbrowser.focus() every time click transparent panel, no luck. move mouse wheel , webbrowser doesn't scroll.

CENTOS Named (BIND DNS) and OPENVPN - How to allow VPN clients to Connect to BIND as DNS -

i have setup openvpn. seems working fine except name lookups not done via bind dns server on server. have added push "redirect-gateway def1" , push "dhcp-option dns 10.8.0.1" to openvpn server config. seem being pushed client. the problem believe bind dns not allowing client connect , name lookups. how go configuring bind allow connections vpn clients? you might running issue of rewriting /etc/resolv.conf on dhcp lease refresh or physical adapter reconnect after vpn has been established. i'd check resolv.conf after vpn connection , after few hours/days when dhcp lease renewed. there ways disable dns propagation dhcp server, http://raamdev.com/2009/configuring-static-dns-with-dhcp-on-debianubuntu/ details

tomcat - Can i forrce browser to import certificate -

i have apache tomcat 6 , using https ssl , browser dowloading , importing certificate automatically , can force browser import certificate , not web server think asking. you want move task of web server verifying says is, , put in control of client machine. does sound sensible? at least that's how sounds me.

php - session_start hangs -

since few hours our server hangs every time session_start. for testing purposes created script looks this: <?php session_start(); ?> calling console hangs , can't stopped ctrl-c, kill -9 works. same calling via apache. /var/lib/php/session/ stays empty permissions absolutely fine, www can write , has read permissions parent folders. according admins there no changes made on server , there no special code registered sessions. server centos 4 or 5 , yesterday working perfectly. rebooted server , updated php, nothing changed. i've ran out of ideas, suggestions? update we solved problem moving project server, while problem still exists on 1 server there no immediate need solution anymore. keep question open in case has idea others having similar problem in future, though. there many reasons that, here few of them: a. session file opened exclusively. when file lock not released whatever reason, causing session_start() hang infinitely on future