Posts

mysql - PHP search form -

i new php please forgive if question or problem seem confusing trying create search form has 2 dropdown option: st. peter or jhs. user types in name of professor , choose school professor teach at. form has below <form name=form action="form.php" method="get"> <input type="text" name="find" /> <select name="school[]" > <option value="">school</option> <option value="1">st.peter</option> <option value="2">jhs</option> </select> <input type="submit" name="submit" value="search" /> </form> the form.php script using is <?php $q=$_get["find"]; $s=$_get["school"]; $con = mysql_connect('localhost', 'peter', 'abc123'); if($q && ($s==st.peter)) echo "that professor belongs st.peter h.s"; else{echo "that professor not belong school...

concurrency - Features for profiling concurrent program behaviour in Java -

nowadays there profilers promise profile concurrent behavior of program execution in order understand threaded execution. i collection features useful java profiler concentrating on profiling concurrency only: what i've collected far: construction of waits-for graphs detect potential deadlocks time measurement of accessing resources (data-structures, etc.) show states of every thread (alive, interrupted, dead) which thread called thread accessing shared ressources (wait, blocked, etc.) what ideas have? aiming unveil bad programming habits when dealing concurrency in java. summary statistics each thread: how time spend in each state (running, runnable, blocked etc).

CSS relative positioning -

i want .tag element placed literally on top of img tag. i've tried position: relative it's not quite working i'd to. don't want .tag push image below it. <div class="first center"> <div class='tag'></div> <img src=''/> </div> position: relative on outer div, , position: absolute on two elements div inside. see here explantion of why works: http://css-tricks.com/absolute-positioning-inside-relative-positioning/ live demo: http://jsfiddle.net/xakbp/

language agnostic - Detect if a string was double-encoded in UTF-8 -

i need process large list of short strings (mostly in russian, other language possible, including random garbage cat walking on keyboard). some of these strings encoded in utf-8 twice. i need reliably detect if given string double-encoded, , fix it. should without using external libraries, inspecting bytes. detection should fast possible. the question is: how detect given string encoded in utf-8 twice? update: original strings in utf-8. here as3 code second encoding (unfortunately don't have control on client code, can't fix this): private function toutf8(s : string) : string { var bytearray : bytearray = new bytearray(); bytearray.writeutfbytes(s); bytearray.position = 0; var res : string = ""; while(bytearray.bytesavailable){ res += string.fromcharcode(bytearray.readunsignedbyte()); } return res; } mystring = toutf8(("" + mystring).tolowercase().substr(0, 64)); note tolowerca...

iphone - NSPredicate endswith multiple files -

i trying filter array using predicate checking files ending in set of extensions. how it? would close 'self endswith in %@' work? thanks! nsarray * dircontents = [[nsfilemanager defaultmanager] contentsofdirectoryatpath:documentsdirectorypath error:nil]; nsarray * files = [dircontents filteredarrayusingpredicate: [nspredicate predicatewithformat:@"self contains %@", [nsarray arraywithobjects:@".mp4", @".mov", @".m4v", @".pdf", @".doc", @".xls", nil] ]]; you don't want contains array, want in. ideally want filter path extension. so nsarray *extensions = [nsarray arraywithobjects:@"mp4", @"mov", @"m4v", @"pdf", @"doc", @"xls", nil]; nsarray *dircontents = [[nsfilemanager defaultmanager] contentsofdirectoryatpath:documentsdirectorypath error:nil]; nsarray *files = [dircontents filteredarrayusingpredicate:[nspredicate ...

asp.net - Deploying SharePoint layout ASP .NET assembly into GAC -

i'm rewriting legacy sharepoint application , need figure out how deploy it. application sharepoint solution several features, including webparts , simple web pages code. there webpage designed deployed in layouts subfolder. in production environment, there no codebehind in layouts subdirectory, .aspx file. i understand corresponding codebehind assembly loaded gac. indeed, there. page code doesn't contain <%@ assembly %> directive ask in gac, nor specify fully-qualified name: <%@ page language="c#" autoeventwireup="true" codebehind="default.aspx.cs" inherits="badwolf._default" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <!-- --> </html> so how page locate code assembly in production environment? need deploy same code differen...

translation - Auto translating website using Google Translate -

i need find way translate website appropriate language locale settings on users machine. in otherwords germany visits site, locale settings german, nou site displays in german, possible using google translate or there other options available? i know when visit site in language using google chrome, says "this site appears in [drop down languages]. want google translate it?" might have api can per page. however, if site @ professional, should translate site you, google translate fails in embarrassing ways.