Posts

Showing posts from April, 2010

sliding window over 2d array in vb.net -

i'm having problems sliding variable sized window on 2d array in vb.net. porblem when take first element of array @ 0,0 ever size of window needs smaller because element in question has center of sliding window. ex: arrar size(40,43) window size 5x5 ( window size nxn n=3 wins size 3x3) array(0,0) win size 5 2 col , 2 rows need cout out , new window size of 3x3. great.` public function getpixelsinwindow(byval wsize integer, byval x integer, byval y integer) dim temparray new arraylist() dim xwidth integer = wsize dim yheight integer = wsize dim xvalue integer = x - wsize / 2 dim yvalue integer = y - wsize / 2 dim imgheight integer = me.mysize.height dim imgwidth integer = me.mysize.width dim i, j integer while xvalue < 0 xvalue += 1 xwidth -= 1 end while while xvalue > imgwidth xvalue -= 1 xwidth -= 1 end while while x...

java - Searching Movie name in the Download URL -

we require verify, if given url has searchstringkeyword using regular expression. for example if url : http://thepiratebay.org/torrent/3962906/mera.naam.joker.1970.limited.dvdrip.xvid-d3si" searchstringkeyword : mera naam joker expected outcome: true searchstringkeyword : dvdrip expected outcome: true searchstringkeyword : speed expected outcome: false any highly appreciated. amit your examples aren't quite comprehensive. if want match url words "mera", "naam", , "joker", in order, number of characters separating them, use this : /mera.*naam.*joker/ if want there 1 , 1 separating character, don't care character is, use this : /mera.naam.joker/ if want there single . character between words, this : /mera\.naam\.joker/

http - How can I build an internet download manager in Java? -

i building internet download manager using java. how file size server? also, there way divide file partitions can download them in parallel? first part of question: http://download.oracle.com/javase/1.4.2/docs/api/java/net/urlconnection.html url.openconnection().getcontentlength()

Visual Studio Crash when typing in editor -

i have been using vs2010 few weeks past few days has been totally unusable, when type editor visual studio throws exception, lots of intellisence errors (the code fine, can compile if run before trying use editor) - here log message: <entry> <record>241</record> <time>2011/01/25 08:30:34.109</time> <type>error</type> <source>editor or editor extension</source> <description>system.invalidcastexception: unable cast com object of type &apos;system.__comobject&apos; interface type &apos;microsoft.visualstudio.textmanager.interop.ivstextreplaceevents&apos;. operation failed because queryinterface call on com component interface iid &apos;{cf9928d9-65ae-4319-a446-94ed5c45ecde}&apos; failed due following error: no such interface supported (exception hresult: 0x80004002 (e_nointerface)).&#x000d;&#x000a; @ system.stubhelpers.stubhelpers.getcomipfromrcw(object objsrc, intptr ...

c# - Need WPF Design Ideas For A New Application -

i have build several wpf screens has many editable fields. there separate business object (view model) create views along set of rules every screen, list of rules apply of fields, defines things if editable, default value, list of values shud display. . firstly,i thinking generate views data templating corresponding business object view. need ideas on how validate these rules or apply these kind of rules properties in bussiness object. hopefully, clear have mentioned above. i looking design ideas, wpf oob features if any, common paterns or frameworks, scenarios such these. such idea of help. thanks, mani have @ the silverlight dataform ported wpf

call javascript function from django -

can javascript function called django httpresponseredirect or other django function if you're talking in-browser js, no, django cannot call javascript function. you've got django running on server, , js running in user's browser, , ne'er 2 shall mingle. imagine if ol' django site out there reach browser @ , start doing things didn't ask for! what can setup sort of communication between two, ala ajax. have javascript side periodically poll django server information, @ point django can tell javascript (do this function, run that process). or figure out how comet . otoh, if you're talking server-side js, sure, why not? it'd same calling perl function, or ruby function (feed interpreter correct instructions import/define/call function).

python - Programmatically converting/parsing LaTeX code to plain text -

i have couple of code projects in c++/python in latex-format descriptions , labels used generate pdf documentation or graphs made using latex+pstricks. however, have plain text outputs, such html version of documentation (i have code write minimal markup that) , non-tex-enabled plot renderer. for these eliminate tex markup necessary e.g. representing physical units. includes non-breaking (thin) spaces, \text, \mathrm etc. nice parse down things \frac{#1}{#2} #1/#2 plain text output (and use mathjax html). due system we've got @ moment, need able python, i.e. ideally i'm looking python package, non-python executable can call python , catch output string fine. i'm aware of similar question on tex stackexchange site , there weren't programmatic solutions that: i've looked @ detex, plastex , pytex, seem bit dead , don't need: programmatic conversion of tex string representative plain text string. i try writing basic tex parser using e.g. pyparsing, a) mig...

php - Best Algorithm for choosing the right data to present to the user based on his choices -

i'm working on project tries match events in city based on interests of user. basically, end user in front end has select interests (culture, sports, fun, food...there 8 of them) values range 0 10. in end (where events created) webmaster can choose score each category (culture, sports, fun...the same front end). best algorithm use find relevant results based on user input? i'm using php (although think not language specific question). compare each of scores of events user profile. lower deviation, better event matches user's interest. in sql this: select ... `events` ... order ( abs(`culture` - $culture) + abs(`sports` - $sports) + abs(`fun` - $fun) + ... ) asc you weight scores according distribution of points in user profile. means if user has $culture = 10 , other scores 0, particularly interested in culture , may better results with select ... `events` ... order ( (abs(`culture` - $culture) * $cultureimportance) + (...

values of one combo box on basis of other combo box - php -

i have 2 tables categories , sub-categories in database. on form have 2 combo boxes category , sub categories. want when change category, subcategories should change accordingly. can if arrays defined in javascript. in case subcategories load database on basis of value of category selected. can fetch data database using php. if data in php array how pass javascript. how can solve problem without ajax? if solution json how can implement json never used it. either put subcategories in javascript or you'll have use ajax. it's easy pass data php javascript. if have subcategories in array $subcategories can use result of json_encode($subcategories) safely in javascript (it - o wonder - json encodes array). so either make ajax service returns specific subcategory or write php script generates javascript array containing subcategories. a simple ajax service this: $id = (int)$_get['category']; // id of category $subcategories = ... // fetch array of subc...

c# - TextWriter not writing all files -

i've got written service has separate thread running reads 400 records database , serializes them xml files. runs fine, there no errors , reports files have been exported correctly, yet handful of xml files appear afterwards, , different number each time. i've checked see if it's record causing problems, read out fine, , seem write fin, don't... after playing around , putting delay in of 250ms between each write exported properly, assume must have writing many files in such quick succession, have no idea why, have thought report kind of error if didn't write properly, yet there's nothing. here code wants try it: static void main(string[] args) { exporttestdata(); } public static void exporttestdata() { list<testobject> testobjs = getdata(); foreach (testobject obj in testobjs) { exportobj(obj); //thread.sleep(10); } } public static list<testobject> getdata() { list<testobject> result = new li...

wpf - ScrollViewer to dynamically fetch new rows when reaching the bottom -

i wish create scrollviewer shows vertical scrollbar regardless of whether has items scroll down or not. doing this, seek dynamically fetch more data db user scrolls towards bottom. data stored in datagrid (dggrid), , wrapped scrollviewer (svmain) (see below). data db retrieved using a method triggers on scrollviewer.scrollchanged event. <scrollviewer grid.row="0" verticalscrollbarvisibility="visible" dockpanel.dock="top" name="svmain" cal:message.attach="[event scrollchanged] = [action scrollmaster($eventargs)]"> <stackpanel> <grid visibility="{binding path=isformview, converter={staticresource booleantovisibilityconverter}}"> <grid.columndefinitions> <columndefinition width="200"/> <columndefinition width="200"/...

jquery - Capturing the tab key using JavaScript in Firefox -

i use following restricts user enter characters. when press tab, cursor not point next control (in mozilla). works fine in ie. // restricts user enter characters other z, z , white space( ) // rauf k. 06.11.2010 $("input:text.characters_only").keypress(function(e) { if (!((e.which >= 65 && e.which <= 90) || (e.which >= 97 && e.which <= 122) || e.which == 32 || e.which == 8 || e.which == 9)) { return false; } }); i recommend trying e.keycode instead of e.which . here link describes method of getting key strike single variable regardless: jquery event keypress: key pressed?

Edit a text file using php -

i download file , need replace few strings own string. able replace them... how can make changes permanent...??? but file download html file. try using file_put_contents . make sure file or directory write writable.

visual studio - What do "Update Web/Service References" and "Update to latest version" do in VS2005? -

presumably different. i still seem have remove , re-add references on occasion, , clear on these things do. right, tiny breakthrough: "update folder latest version" relates version control, not webservice itself. therefore quite silly question. never-the-less, seems have remove , re-add, because updating seems not trick. ho-hum.

c# - RGB to HSL and back, calculation problems -

i'm trying convert rgb hsl , want convert hsl rgb, have written class if rgb->hsl->rgb try if works different value. example case: if create hslcolor object doing hslcolor mytestconversion = hslcolor.fromrgb(colors.green); , color expectedgreenhere = mytestconversion.torgb() different color colors.green while original input goes wrong.. this code i'm using: public class hslcolor { public float hue; public float saturation; public float luminosity; public hslcolor(float h, float s, float l) { hue = h; saturation = s; luminosity = l; } public static hslcolor fromrgb(color clr) { return fromrgb(clr.r, clr.g, clr.b); } public static hslcolor fromrgb(byte r, byte g, byte b) { float _r = (r / 255f); float _g = (g / 255f); float _b = (b / 255f); float _min = math.min(math.min(_r, _g), _b); float _max = math.max(math.max(_r, _g), _b); flo...

Jquery customized tabs -

i need give option users in web application create many tabs can. when click on "add button" should able add new blank tab drag widgets. not getting how using jquery. can 1 suggest me solution problem. jquery-ui tabs provides method add tabs dynamically.

From Silverlight 3 to Silverlight 4 + WCF RIA Services migration issue -

i have had 2 projects: 1 silverlight 3 application , other .net 3.5 web application wcf services. have changed type of silverlight 3 app silverlight 4 , specified web application wcf ria service link in silverlight 4 app. and when build projects error: the type or namespace name 'domainservices' not exist in namespace system.servicemodel' (are missing assembly reference?) how can resolve problem? i expect see if did not add references ria services libraries on server. typically 2 want are. system.servicemodel.domainservices.hosting.dll system.servicemodel.domainservices.server.dll also, easy way ria pieces set create new default domainservice using item template. right click on web project, add new item, select new domainservice, use default options, , select ok. add assembly references make few web.config changes necessary ria running.

windows - Is there any reason why a Win Service would not execute functions in an external library? -

i new writing windows services strange me. have debugged external library using winform. external library drive mapping, copying directory structure, deleting original directory, renaming copied directory, , removes mappings. so, when write service initialize external class , start process, service doesn't seem doing think should doing. appears doing nothing , ignoring going on. is there missing? external library need have security attributes? update found out how attach debugger, per @will's comment: system.diagnostics.debugger.break() edit helps when copy app.config file correct directory!!! not lot go on here. first, can debug service, should doing rather using winform frontend test code. the issue either service not created properly, or you've got security issue. your service receive start message, after must run own code, on different thread (a timer common way this). if service touching drive, user account under executes must have righ...

Multiple inheritance in C++ -

as know, c++ allows multiple inheritance . but, programming approach use multiple inheritance or should avoided? thanks. in general, it's not needed , can make code more complex. but there cases it's useful. long it's useful , isn't causing code become unmanageable, see no reason avoid it.

Capture method calls in Java -

i need capture method call in java , not want use jpda or jdi; want happen in original jvm. for instance: public class { public void m() {} } public class main { public static void main(string[] args) { a = new a(); a.m(); } } i not want let method execute @ time, need capture , schedule in queue. thus, aop not me in regard. thought proxying method. such as: public class { public void m() { methodqueue.add(new methodinvocation() { public void invoke() {m_orig();} }); } private void m_orig(){} } any ideas? in advance. you can use technique called dynamic proxies in java. described in detail in following document: dynamic proxies the solution problem (with little changes necessary): public interface { void m(); } public class aimpl implements { public void m() {} } public class enqueueproxy implements java.lang.reflect.invocationhandler { private object obj; public static object newinstance(object obj) { ...

Access 2010 VBA query a table and iterate through results -

i have query want execute against table. results want something. in head pseudo code is: var q = "select * table condition"; var results = db.getresults(q); foreach (row r in results ) result how similar vba? dao native access , far best general use. ado has place, unlikely it. dim rs dao.recordset dim db database dim strsql string set db=currentdb strsql = "select * table condition" set rs = db.openrecordset(strsql) while not rs.eof rs.edit rs!somefield = "abc" rs!otherfield = 2 rs!adate = date() rs.update rs.movenext loop

java - Reverse XML Child tags -

what best option reverse lines / tags in xml in java e.g. <?xml version="1.0"?> <abc> <xyz1 test1="123" test2="345"> </xyz1> <xyz2 test1="456"> </xyz2> </abc> </xml> end result <?xml version="1.0"?> <abc> <xyz2 test1="456"> </xyz2> <xyz1 test2="345" test1="123"> </xyz1> </abc> </xml> using comparator this: public int compare(object arg0, object arg1) { if (arg0 instanceof element && arg1 instanceof element) { return ((element) arg0).getattribute("id").compareto( ((element) arg1).getattribute("id")); } else { ...

winapi - win32 api edit control can't be selected or edited -

i created edit control using win32 api this: createwindow("edit", "", ws_child | ws_visible, 0, m_position, controls_width, editbox_height, m_editorwindow, (hmenu)getnextcomponentid(), m_instance, null) i can change text using setwindowtext, can't select or edit it's content - purpose of edit control, or not?:)) i read on msdn http://msdn.microsoft.com/en-us/library/bb775458%28vs.85%29.aspx must use edit_enable don't know find thin macro , don't heave idea how enable editing. when move cursor on cursor changes standard edit cursor. thank help! or try: hwnd mywindow = createwindow("edit", "", ws_child | ws_visible, 0, m_position, controls_width, editbox_height, m_editorwindow, (hmenu)getnextcomponentid(), m_instance, null); enablewindow(mywindow, true);

csv - R character factor to numeric vector -

i read in csv file "3:29" in 1 of fields (without quotation marks). comes factor. how can convert numeric vector e.g. c(3:29)? tried as.vector() gives string vector "3,4,5,6...29" (with quotation marks, still character class). edit answer needs applicable more general form, example, column contain 3:6,7,9:11, needs converted equivalent c(3:6,7,9:11). you can do: > eval(parse(text='3:29')) [1] 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 [26] 28 29

web applications - Simple web site user management with Spring -

i've done many sites, using java, php, etc... when needed user management use httpsession , db keep passwords , session data. what's recomended/standard way of doing spring in simple way? there "sub"-project of spring: spring-security . need. provides "jdbc-user-service" authentication provider reads user database table out of box.

Unmangling C++ DLL Function Names -

possible duplicate: how stop name-mangling of dll's exported function? i have dll written in c++. exported function names need unmangled. example, int myfunc( int param1, int param2 ); needs appear outside application trying call library function myfunc . however, when @ using dependency walker, looks _myfunc@8 . how have declared in c++: extern "c" __declspec(dllexport) int winapi myfunc( int param1, int param2 ); i thought extern "c" trick. how rid of mangling? thanks. ways rid of mangling: (assuming msvc build environment) export via .def file. export extern "c" ensuring __cdecl calling convention used. __stdcall prepends _ , postpends @ on dll exported functions when extern "c" used. extern "c" __declspec(dllexport) int __cdecl myfunc(int param1, int param2); export using #pragma directive. need pass mangled name on other side of this. __funcdname__ useful directive put in macro in ...

Handling CPU exceptions in C++ -

is there cross-platform way handle cpu exceptions segmentation faults, or division zero? lets say, need call potentially unsafe functions (for example plug-in file), can cause segfault, or other problems cannot test before execute it. know, c standard library has signal handling functions, don't know how use them handle problem avoid program termination (i guess, can't jump location before problematic functions execution, or can i?). under windows use seh exception handlers, can't under linux, or other os. using own exception handler handle these problems, how different between windows/linux? possible (via assembler - lets on x86 platform)? i'm asking out of curiosity, i'm not trying solve existing problem (yet). thanks libsigsegv cross-platform library handling segmentation faults , stack overflows. however, in vast majority of cases, when detect segmentation fault, right thing terminate execution fast possible instead of trying recover it. segfau...

plugins - Twitter is now blocked in Egypt , I have domain and I want to bypass throw it is there a way? -

twitter blocked in egypt , have domain , want bypass throw there way ? the general mechanism set local proxy on machine in egypt. proxy connects through secure channel safe host (or hosts) route http/dns traffic internet. in order use local proxy instead of direct connections, have set web browser. there 2 alternatives scheme: either use ssh client proxy , domain; or use tor , distributed network of proxies. ssh if blocked machine runs linux: start local socks proxy part of standard ssh client running in standard terminal: ssh -d 12345 your_username@yourdomain_outside_egypt.net (where 12345 local port number) then configure firefox use tunnel: go about:config , set: network.proxy.socks -> 127.0.0.1 (localhost doesn't work) network.proxy.socks_port -> 12345 network.proxy.socks_remote_dns -> true (dns connections use proxy) network.proxy.type 0 tor safer alternative use onion-routing same thing on machine (you've got proxy , encrypted conn...

java - Any good advanced guides on how to create new maven archetypes? -

i'm looking guide on how create new maven archetypes involve using parameters create directories , file names parameters used prefixes in file names , part of package structure/directories created archetype. all can find simple instructions on how make simple projects. why not use maven website itself? http://maven.apache.org/guides/mini/guide-creating-archetypes.html

How to adjust the width of a font using the Uniscribe API -

please bear me, new uniscribe hope isn't dumb question have been unable find solution anywhere else. so, here goes... i trying use uniscribe api reduce width of font; is, given specific font of particular height, able reduce width of each character (and relevant spacings) user-defined percentage. i have achieved without calling uniscribe functions obtaining logfont structure current font , adjusting lfwidth field percentage of original value. realise average character width seemed have desired result. however, when try same thing using uniscribe i've noticed lfwidth field gets reset 0 following calls scriptshape() . result, rendered text output using original width. i'm @ loss explain why or around it. does have idea if it's possible trying do? you might want start here (look @ generate glyph information section), lead this . hope helps!

php - .htaccess seo rewrite -

my current setup is: site.com/dir/56 what want is: site.com/dir/56/some-string-here-about-the-page my current .htaccess setup is: rewriteengine on options +followsymlinks rewriterule ([0-9]+) index.php?id=$1 i'm not .htaccess expert, seems me existing setup work. doing taking uri given , finding integer inside -- anywhere inside it. ignores other text in uri, rewriting index?id=$1. $1 integer found, example, 56. you more explicit , try this: rewriteengine on options +followsymlinks rewriterule dir\/([0-9]+)(\/)? index.php?id=$1 however, i'm reasonably sure fancy-urls work correctly without change.

php - CakePHP on a Shared Hosting public_html -

i have installed cakephp on shared host server. i 404 error the mod_rewrite looks this /home/user/public_html/cms/.htaccess <ifmodule mod_rewrite.c> rewriteengine on rewriterule ^$ app/webroot/ [l] rewriterule (.*) app/webroot/$1 [l] </ifmodule> /home/user/public_html/cms/app/.htaccess <ifmodule mod_rewrite.c> rewriteengine on rewriterule ^$ webroot/ [l] rewriterule (.*) webroot/$1 [l] </ifmodule> /home/user/public_html/cms/app/webroot/.htaccess <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(.*)$ index.php?url=$1 [qsa,l] </ifmodule> the url http://server/~user/cms , server path /home/user/public_html/cms you have add rewritebase remove http://server/~user/ url. cake not work ~ in url

WWW:Mechanize Perl Module install errors -

i attempting install www:mechanize module on xammp server. have copied test results displayed @ end of install here: test summary report ------------------- t\local\back.t (wstat: 256 tests: 47 failed: 1) failed test: 33 non-zero exit status: 1 t\local\click_button.t (wstat: 0 tests: 19 failed: 0) todo passed: 15-17, 19 files=51, tests=554, 203 wallclock secs ( 0.51 usr + 0.11 sys = 0.62 cpu) result: fail failed 1/51 test programs. 1/554 subtests failed. nmake : fatal error u1077: 'c:\windows\system32\cmd.exe' : return code '0xff' stop. petdance/www-mechanize-1.66.tar.gz nmake.exe test -- not ok //hint// see cpan-testers results installing module, try: reports petdance/www-mechanize-1.66.tar.gz running make install make test had returned bad status, won't install without force failed during command: petdance/www-mechanize-1.66.tar.gz : make_test no can tell me why there many errors, , has www:mechanize installed in sp...

.net - Xml serialization of child class with dotnet. Don't write the child root node from parent class -

here's problem. have parent class "foo" , child class "bar" : [serializable] public class foo, ixmlserializable { public bar child {get; set;} #region ixmlserializable membres public system.xml.schema.xmlschema getschema() { return null; } public void readxml(system.xml.xmlreader reader) { throw new notimplementedexception(); } public void writexml(system.xml.xmlwriter writer) { new xmlserializer(this.child.gettype()).serialize(writer, this.child); } #endregion } [serializable] public class bar { [xmlelement] public string myelement1 {get; set;} [xmlelement] public string myelement2 {get; set;} } if serialize classes it, i'am going : <xml> <foo> <bar> <myelement1>beer</myelement> <myelement2>vodka</myelement> </bar> </foo> but, how can control serialization from...

ios - Can I use my Windows 7 to OS X emulator to upload binary -

i don't want buy mac upload ios binary itunes using application loader. there way use emulator this? simply put answer no . have use relevant version of xcode ios want upload to. example ios7 requires xcode 5. because before can upload binary must first archive , validate it. validation quick apple check on binary ensure nothing wrong it. must code sign distribution certificates. far i'm aware there no emulators on windows can this.

html - How to clear content from a "position: fixed" element of variable height? -

i have header on web site, height of changes based on many server-side factors. has been requested header modified have fixed position, when user scrolls page, header remains @ top. using position: fixed achieve effect. problem when header becomes tall, lays on top of of content (even when scrolled way top). can apply top-margin content div extend past header, mentioned earlier value of margin vary based on many factors not available css. there easy way tell browser render section of content below fixed layer? i have tried applying clear content, didn't anything. know in javascript, looking css-based solution. i don't think it's possible. when assign position: absolute or position: fixed element, removed flow of document , it's dimensions no longer relevant siblings.

watin - Cannot convert lambda expression to type 'string' because it is not a delegate type -

w => w.classname == "button" && new winbutton(w.hwnd).title == "ok" i using class clicks 'ok' on dialog windows opens while testing website on watin. line gives error of lambda expression cannot converted type string because not delegate type. i have used using system.linq , still not work please me out! the whole code follows: using system; using system.text; using system.collections.generic; using system.linq; using microsoft.visualstudio.testtools.unittesting; using watin.core; using sco.automated.testing.service; using watin.core.dialoghandlers; using watin.core.native.windows; using watin.core.native.internetexplorer; namespace sco.automated.testing.service { public class okdialoghandler : basedialoghandler { public override bool handledialog(window window) { var button = getokbutton(window); if (button != null) { button.click(); retur...

Android activity stack size problems? -

i have application lots of activities. many of these activities can start others, user's expected generate quite large activity stack. i'm using default activity launch behaviours. know, if large activity stack (like > 100) pose problem? there limit this? decrease performance, cause anr dialog, or that? thanks android kill activities when needs to free memory or other resources. per activity lifecycle , , activity eligible killed no longer visible. assuming correctly handle killing , restarting of activities, should fine. as aside, struggle come use case user's perspective access > 100 activities in 1 app...

C++ CMD input along with exe -

sorry such noobie question, how can program read data input program, how cmd options shutdown.exe -f how read example -f program? this should print out each of whitespace delimited parameters passed program. #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { for(int = 0; < argc; i++) { printf("%s\n", argv[i]); } return 0; }

wpf - How do I trap keyboard input from a Popup control -

i wanting receive keyboard input popup control acts root visual touch screen keyboard control. i'm wanting control support keyboard input touch screen input. hook events (previewkeydown , keydown) , never fired. a popup not focusable default , if focusable, have have else focusable on popup , focused or give focus in order receive keyboard event. in other words, if want keyboard event popup use focusable="true" , put focusable control textbox or button or listbox , either let user give focus clicking on or manually use focus() code. if these things previewkeydown should fire popup . here little demonstration program toggle button opens popup , shows slider increasing whenever previewkeydown event on popup : <grid> <stackpanel> <slider name="slider1"/> <togglebutton x:name="togglebutton1" content="open popup"/> </stackpanel> <pop...

javascript - jquery timeout solution? -

let (i simplify) have 4 div content... fade/hide them if mouse left unmove 2 sec , when mouse mouve again... let quikly make appear again... how simple make in jquery ? i not used timetout , mouse.. more css used ! i google "concept" , find : hide div element jquery, when mouse isn't moving period of time? i investigate if work ! you need create run-a-way timer restarts on every mousemove. $(document).bind('mousemove', function() { var $somediv = $('#somediv'); return function() { if(!$somediv.is(':visible')) $somediv.fadein('slow'); this.tid && clearinterval(this.tid); this.tid = settimeout(function() { $somediv.fadeout('slow'); }, 2000); }; }()); demo : http://www.jsfiddle.net/byrkk/

javascript - div not loading in right place -

hi im trying load div next link/button if clicked unauthenticated users. i have following: $(function () { $(".unauthenticated").click(function () { showmessage($(this).attr("id"), "#unauthenticated-div") }); function showmessage(clickeditemid, divid) { clickeditem = $("#" + clickeditemid); var pos = clickeditem.offset(); var width = clickeditem.width(); $(divid).css({ "left": pos.left + width + 10, "top": pos.top + 10 }).show(); } }); <div id="unauthenticated-div" title="please login" style="display: none;"> <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"> </span>you must <a href="#" id="login-link">login</a>or <a href="/account/register/">register</a>to this...

How to check if ffmpeg is done encoding a video with PHP? -

i need specific code check php if done encoding video ffmpeg. need simple true/false check. true if encoding done, , false if not done. language php, , have ffmpeg-php installed. more info: on linux. code below converttoflv( $input, $output ); function converttoflv( $input, $output ) { echo "converting $input $output"; $command = "ffmpeg -y -i $input -acodec libfaac -ar 44100 -ab 96k -vcodec libx264 -level 41 -crf 20 -bufsize 20000k -maxrate 25000k -g 250 -r 20 -s 640x480 -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +brdo+dct8x8+bpyramid -me umh -subq 7 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurcplx^(1-qcomp)' -bf 16 -b_strategy 1 -bidir_refine 1 -refs 6 -deblockalpha 0 -deblockbeta 0 $output"; shell_exec( $command ); } you add line of code after ffmpeg in php exec() run php page in command line. just end ffmpeg line ";" , type "php" followed ab...

.net - Adding System.Web reference to Business Logic Layer in n-layer Architecture -

i'm using tableprofileprovider use asp.net profile system in n-layer architecture. ui layer web application have expose profilecommon class able use profiles. here's simplified schema of architecture: ui: asp.net web application. businessentities: pure poco classes. persistence igronace. bll: business logic layer. dal: data access layer. the profilecommon definition is: public class profilecommon : profilebase { public virtual profilecommon getprofile(string username) { return (profilecommon)profilebase.create(username); } public virtual string firstname { { return (string)base.getpropertyvalue("firstname"); } set { base.setpropertyvalue("firstname", value); } } } in simple design architecture defined in web application project, i'd access profilecommon follows: profilecommon strongleytypedprofile = (profilecommon)this.cont...

properties - How to have a parent property in C# class? -

for example, in following classes need have parent property in cupboard , shelf . how do it? public class room { public list<cupboard> cupboards { get; set; } } public class cupboard { public room parent { { } } public list<shelf> shelves { get; set; } } public class shelf { } you can use automatically implemented property: public class cupboard { public room parent { get; set; } } you can choose make setter private , set in constructor. public class cupboard { public cupboard(room parent) { this.parent = parent; } public room parent { get; private set; } } usage: room room = new room(); cupboard cupboard = new cupboard(room); console.writeline(cupboard.parent.tostring()); if have many objects have parent room might want create interface can find out room object's parent without having know specific type. interface iroomobject { room { get; } } public class ...

Wordpress - get_the_tag_list - only text! -

i need script output tags text post tags. not links, ul's , other stuff, plain text can add text class of post. can help? thank you! founded answer here: need in using get_the_tag_list($id) wordpress <?php $posttags = get_the_tags(); if ($posttags) { foreach($posttags $tag) { echo $tag->name . ' '; } } ?>

c# - Weird network devices -

Image
i using networkinformation namespace list network devices. networkinterface.getallnetworkinterfaces(); when list, there weird unknown devices: what they? , should i, , if, how, rid of them? in theory should show local area connection , wireless connection. under network connections can't find installed either. windows has network 'devices' don't exist in terms of physical hardware - they're used various things, such vpn connections (like tunneling pseudo interface) , loopback adapter, responds 127.0.0.1 you can parse non-physical addresses using wmi query list of adapters instead, using (managementobjectsearcher searcher = new managementobjectsearcher(new selectquery("win32_networkadapter"))) { foreach (managementobject mo in searcher.get()) { if ((bool)mo["physicaladapter"]) console.writeline(mo["name"]); } } (taken msdn) that'll return physical devices, you're castin...

Variable HTML table cell height? -

<table> <tr> <th><img src="image.jpg" /></th> <td>row1 column2</td> <td>row1 column3</td> <td>row1 column4</td> </tr> </table> results if height of img equal 10px, height of cells in row equals 10px. adding border td's results in td's looking taller img. note: img contained in th because not want border around img, td's. desired results link image displayed in image above, height of td's should adjustable top , bottom borders can aligned img. research using css specify height on td's works if height larger height of img (in other words, td's cannot smaller img). additional research indicates way tables work. thanks reading. appreciated :) generally speaking, in table, <td> elements same size within row, purpose of rows, can align cell contents within row, otherwise row have consistent height. height of r...

How to modify "Cache-Control" header in Drupal 5.x? -

we using drupal 5.x. experimenting squid reverse proxy. squid , drupal configured. static content getting cached. for testing purposes, set "cache-control: public ..." on 'authenticated' pages returned drupal. we see headers set in bootstap.inc. we've modified instances of "cache-control" header in file, set 'public'. however, when view http headers (in safari's web inspector), see "cache-control:private". reason, squid returning cache miss on pages. question - "cache-control" getting set "private"? how can change "cache-control" header authenticated users? thanks in advance! try pressflow (https://launchpad.net/pressflow/5.x) fork of drupal built in cache control.

java - JVM: Can't detect initial thread stack location - find_vma failed -

the compilation successful multiplication should have been performed @ compile time without code being generated. however, solution generated following code: java hotspot(tm) 64-bit server vm warning: can't detect initial thread stack location - find_vma failed mov ax,5 mov ax,6 mul ax [ expected value 30, calculated result 6 ] i entered code in school's system , got error message. don't understand part says "the multiplication should have been performed @ compile time without code being generated.". anyone know might doing wrong? (i can't reveal code entered in it, because don't want showing in search engine. there way can privately show code entered in?) the can't detect initial thread stack location suggests incomplete or corrupt java installation. the stuff multiplication @ compile time doesn't comes java, instead sort of ide or compilation tool school using. whatever "school system...

c++ - Iterating through objects in JsonCpp -

i have c++ application uses jsoncpp decode json string. have created following function shows me top level objects... how dump entire object list? --function-- savejson( json_data ); bool cdriverconfigurator::printjsontree( json::value & root, unsigned short depth /* = 0 */) { printf( " {type=[%d], size=%d} ", root.type(), root.size() ); if( root.size() > 0 ) { for( json::valueiterator itr = root.begin() ; itr != root.end() ; itr++ ) { printjsontree( itr.key(), depth+1 ); } return true; } // print depth. for( int tab = 0 ; tab < depth; tab++) { printf( "-"); } if( root.isstring() ) { printf( " %s", root.asstring().c_str() ); } else if( root.isbool() ) { printf( " %d", root.asbool() ); } else if( root.isint() ) { printf( " %d", root.asint() ); } else if( root.isuint() ) { printf( " %d...

php - only pulling one link out using regular expressions -

hi have following code , want pull out links have www. in them <p> text < href="http://url.com/link/">link text</a> more text < href="http://www.anotehrurl.com/">more link text</a> , < href="http://www.anotherurl.com/sub/sub/link.html">link text</a>. more text < href="http://keepurl.co.uk/link/">link text</a> more text < href="http://www.anotherurl.com/sub/sub/link.html">link text</a>. < href="http://www.anotherurl.com/sub/sub/link.html">link text</a>. < href="http://www.anotehrurl.com/">more link text</a></p> im using reg expression: (<a href="http:\/\/www.[\d\d]*?\/">([\d\d]*?)<\/a>) basically want match link starts www , not match link keepurl.co.uk/....... i have put through rubular , come out following: { result 1 1.< href="http://www.anotehrurl.com/">more link ...

Textbox binding does not work ,when changes are made -

hoping have object (skuform),whose property(skucode) bound textbox. if run form , change value in textbox (say "test123"), , hit button, notice object's (skuform) property not reflect new value ("test123"), please suggest wrong. <td> <telerik:radtextbox runat="server" id="txtskucode" text='<%# skuform.skucode %>' enableviewstate="true" wrap="false" ontextchanged="txtskucode_textchanged"> </telerik:radtextbox> </td></tr> <telerik:radbutton id="radbutton1" runat="server" onclick="radbutton1_click"> </telerik:radbutton> try set radtextbox datacontext property class wich implemented inotifypropertychanged interface. when propertychanged event occurs, radtextbox change value. you can see ...

c# - Extract nodes from string containing xml -

i using web service , soap envelope , trying extract data run errors. have tried linq, using xsl transform , on. the response is: <?xml version="1.0" encoding="utf-8" ?> - <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> - <soap:body> - <abrsearchbyabnresponse xmlns="some service /"> - <abrpayloadsearchresults> - <request> - <identifiersearchrequest> <authenticationguid>some guid</authenticationguid> <identifiertype>abn</identifiertype> <identifiervalue>54 108 408 566</identifiervalue> <history>n</history> </identifiersearchrequest> </request> - <response> <usagestatement>some statementusagestatement> <dateregisterlastupdated>2011-01-26</dateregisterlastu...

iphone - How can i set the title of UIButton in front of the UIButton image -

i use [button setimage:image forstate:0]; set image uibutton. then want title of using [button settitle:[titlearray objectatindex:i] forstate:0]; . but image cover title want show in front of image. any solution? thanks! use setbackgroundimage:forstate instead. when use (foreground) image, dont set title.

How to run system() with C#? -

i'm rewriting ruby program in c#. has lot of system() calls (like system("./program")). is there way call in c#, or have use systemm.diagnostics.process? system.diagnostics.process.start .net equivalent system() in ruby. or have use systemm.diagnostics.process? you can add using system.diagnostics; @ top of file. becomes process.start("program.exe"); .

sql - Time out retrieving items from list -

i have problem retrieving items large list. can , retrieve items small list more or less 50 items, when try retrieve items list containing more or less 4600 items, sqlsever.exe process spikes duration of request, items never retrieved. if have set web applications throttling settings, can’t causing problem. here code used retrieve items. there nothing special it. using (spsite site = new spsite(siteurl)) { using (spweb web = site.openweb()) { splist list = web.lists[uid.tostring()]; splistitemcollection itemcollection = list.items; foreach (splistitem in itemcollection) //this code stops responding { //use list items } } } after didn’t work, tried couple of other methods retrieve items list. here code: splist list = web.lists[uid.tostring()]; spquery query = new spquery(); query.query = ""; query.querythrottlemode = spquerythrottleoption.override; splistitemcollection itemcollection = list.getitems(query); //the code stops here //i added part i...

algorithm - Find logo in desktop screenshot -

i need develop desktop application 1.) have list of different application logos (background transparent) e.g. ie, firefox, chrome, photoshop etc. 2.) user take screenshot of desktop , save image. 3.) application need search logos in screenshot image , tell logos present , where. 4.) used opencv, it's working, when user changes desktop background & captures screenshot, it's not working transparent area of logo getting desktop background content. can provide solution or libraries open source, commercial job. this easy using cross-correlation. see answer this question . basically: start desktop image , 1 template image each icon apply edge detection (e.g. sobel) desktop image , template images. throw away original desktop image , templates, won't need them anymore cause we'll using edge-detected images for each template do template matching would threshold maximum of result. if it's above threshold, have match @ position. othe...

php - How to get session id and do login web form with session id curl? -

how session id , login web form session id curl? set curlopt_returntransfer, store return value of curl_exec() in variable, use string functions and/or regular expressions extract session id page. if session id in header (e.g. set-cookie ), use curl_setopt() set curlopt_header headers included in output. if want use session id later submit form, set curlopt_post true , curlopt_postfields associative array containing post data. useful php documentation links: http://php.net/curl_exec http://php.net/curl_setopt http://php.net/preg_match