Posts

Showing posts from 2010

javascript - Multiple css files with same filename -

i'm trying make this work mvc3 application. looks javascript source working fine. appends whole page(including head , body) bottom of original , tries use css file. first time file declared @ top of page attribute (media='print'). , doesn't apply changes on page. second time plugin declares below, attribute (media='all') , moment should apply changes, show print preview , show buttons. nothing happens, until change manually attribute 'media' 'print' 'all' @ top of page. looks first declaration blocking second one. can't use css file time, because need hide elements in print mode. suggestions? add @media rule in css. @media rule lets group css rules media type in 1 css file: body { color:#444; background-color:#fff; } @media screen, projection { body { background-image:url(background.png); } } @media print { body { color:#000; } } @media handheld { body { color:#0f6517; } }

asp.net - IIS7 403 - Access Denied -

i trying deploy website have built in mvc3 on server runs iis7. able running through iis7 locally on laptop, when try put on server 403 access denied error when trying remotely , "connection has timed out" when try view server itself. i have made sure have recent .net 4 framework using asp_regiis.exe. tried multiple application pools including default. allowed .net4 isapi. have changed permission allow access iuser, server network, authenticated users. have made sure default document list same 1 on laptop iis7 (which works fine). i have multiple other sites (using webforms, not mvc) working fine on server. could have way passed files server? zipped files , placed them (and unzipped them) on server , directed iis created directory. what missing? i faced error last week , can caused many things: the right version of .net framework not installed or registered asp_regiis.exe the "runallmanagedmodulesforallrequests" set false in web.config the right version ...

Entity Framework code first Automated Schema Migration -

is there way ef? i want schema mutate dynamically fit incoming dtos. similar streaminsight doing behind scenes. i don't want touching database directly, modification etc. done program, on fly. not separately, via primer script or visual studio macro, automatically program based on preset logic. another thing, existing data must kept, unless modification calls column dropped. referential integrity violation should construed fatal error. sounds might looking ef migrations, included in 4.3 , above. there's intro ef migrations @ http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-automatic-migrations-walkthrough.aspx

linq - How to pass to Razor view an anonymous type that contains collections? -

i attempting pass collection of anonymous types has in collection of types razor view engine. i using following extension pass dynamic objects view. public static expandoobject toexpando(this object anonymousobject) { idictionary<string, object> anonymousdictionary = new routevaluedictionary(anonymousobject); idictionary<string, object> expando = new expandoobject(); foreach (var item in anonymousdictionary) expando.add(item); return (expandoobject)expando; } it works simple anonymous objects such as: mylinqstatement.select(x => new { foo = x.f, bar = x.b }.toexpando()); however, have been unsuccessful in passing more complex type such as: mylinqstatement.groupby(y => y.foo).select(x => new { foo = x.key, bar = x.select(y => y.b) }.toexpando()); i have made several attempts rewrite ladder statement (i showed simplest), property want (the value of y.b) never accessible within view. any appreciated. i answered own question. mylinqstatement.groupby(y...

.net - Unable to run RegAsm: Error related to access to the Registry -

i have c++ project calls regasm in pre-build event couple of assemblies. pre-build event fails following error: error 1 error ra0000 : error occurred while writing registration information registry. must have administrative credentials perform task. contact system administrator assistance. regasm when checked buildlog.htm has following command in pre-build event: c:\windows\microsoft.net\framework\v2.0.50727\regasm ../../../commonlib/release/services.dll /tlb:c:\tfs\console\solution\bridge\services.tlb so copied command , ran in visual studio 2010 command prompt administrator got same error. i used able build project fine until recently. not sure causing problem. appreciated. i part of administrators group on computer , have turned off uac. open cmd right click "run administrator"

JAVA - what is the difference between void and boolean methods? -

i new java. writing wrapper-library in java make functions available in basic-like language. i got stock @ point when noted code not executed in java-library although compiler did not complain (using eclipse). resolved replacing code follows: public void videoquality(int vquality) //did not work into public boolean videoquality(int vquality) //works here complete code-snippets: public void videoquality(int vquality) //did not work {if (vquality==16) { vidquality=16; } else if (vquality==-16) { vidquality=-16; } else if (vquality==0) { vidquality=0; } else vidquality=-16; vitamioext.setvideoquality(vidquality); } public boolean videoquality(int vquality) //works {if (vquality==16) { vidquality=16; } else if (vquality==-16) { vidquality=-16; } else if (vquality==0) { vidquality=0; } else vidquality=-16; vitamioext.setvideoquality(vidquality); return true; } i think void corresponds sub in visual basic while boolean corresponds function. i found odd following code worked using...

html - Is there a way to make a radio button's background transparent in Chrome? -

i have had quite lot of fun radio button today trying make background transparent. i have tried following: input[type=radio] { background-color:transparent; background-image:none; -webkit-backface-visibility: hidden; } it seems chrome issue alone. i'm own radio buttons using canvas. way can scale them more too. http://jsfiddle.net/gythf/18/ ctx.save() on line 65 causes opaque white background color in chrome browser

ruby - Find two phrases from the larger sentence with the least overlap -

i have: phrase = "will have buy online pass ea play online in perfect condition" phrases = ["its", "perfect condition", "but its", "in perfect condition", "from ea", "buy online pass ea", "to play online in perfect condition", "online", "online pass", "play online in perfect condition", "online its", "ea", "will have buy online pass ea play online in perfect condition", "have buy online pass ea play online in perfect condition", "u", "pass", "to buy online pass ea"] i find 2 phrases array within 6-10 words limit , have least overlap word-wise... something like: result = ["to buy online pass ea", "play online in perfect condition"] would perfect.. best way it? split_phrases = phrases.map {|phrase| phrase.split } # find number of words of overlap between 2 word vectors def overlap(...

xml - XSLT how to sort by variable derived from original field? -

i'm new xslt, , wondering how sort based on derived variable such following (using xslt 1.0): xml: <channel> <item> <title>#2: second guy</title> </item> <item> <title>#3: third guy</title> </item> <item> <title>#1: first guy</title> </item> </channel> xslt attempt: <xsl:for-each select="channel/item" > <xsl:sort select="$rank" data-type="number" order="ascending" /> <xsl:variable name="rankstartposn" select="string-length(substring-before(title, '#'))+1"/> <xsl:variable name="rankendposn" select="string-length(substring-before(title, ':'))+1"/> <xsl:variable name="rank" select="substring(title,number($rankstartposn), number($rankendposn)-number($rankstartposn))"/> <p class="normal"> <xsl:value-of select="title" /> <...

delphi - Can I inherit a class with the same name and use it freely in other units without a unit prefix? -

suppose want override class defined somewhere, example, let's system.classes.toriginalclass , , want keep original class name. know have define this: type toriginalclass = class(system.classes.toriginalclass) ... end; if wanted implement custom overridden class within same unit declared, don't have problem, long every place want used below declared class. but suppose want use replacement class in unit. system.classes extremely common unit, used in every other unit of mine. able use both system.classes unit unit have created overridden version, let's call myclasses . i know in other unit, accomplish including full unit/class in declaration, so: type tmyclass = class(myclasses.toriginalclass) ... end; but, pretty defeat whole purpose, because forced include myclasses. prefix before toriginalclass . not have worry toriginalclass declared, , declare this... type tmyclass = class(toriginalclass) ... end; ...while being sure tmyclass inherited myclasses.toriginalcla...

bash - counting interface types with awk -

i've got following input: 03:00.0 ethernet controller: broadcom corporation netbooty bcm5111 gigabit ethernet (rev 59) 03:00.1 ethernet controller: broadcom corporation netbooty bcm5111 gigabit ethernet (rev 59) 03:00.2 ethernet controller: broadcom corporation netbooty bcm5111 gigabit ethernet (rev 59) 03:00.3 ethernet controller: broadcom corporation netbooty bcm5111 gigabit ethernet (rev 59) 04:00.0 ethernet controller: broadcom corporation netxtreme ii bcm5709 gigabit ethernet (rev 20) 04:00.1 ethernet controller: broadcom corporation netxtreme ii bcm5709 gigabit ethernet (rev 20) 05:00.0 ethernet controller: broadcom corporation netxtreme ii bcm5709 gigabit ethernet (rev 20) 05:00.1 ethernet controller: broadcom corporation netxtreme ii bcm5709 gigabit ethernet (rev 20) 06:00.0 network controller: intel corporation centrino ultimate-n 6300 (rev 3e) this lspci in linux , shows ethernet/wireless devices , corresponding pci ids. in case, output shows me system has 1 quad-port...

php - Get uncommon values from two or more arrays -

is there function in php give array of uncommon values 2 or more arrays? for example: $array1 = array( "green", "red", "blue"); $array2 = array( "green", "yellow", "red"); .... $result = function_needed($array1, $array2,...); print_r($result); should give output: array("blue", "yellow", ...); use array_diff , array_merge : $result = array_merge(array_diff($array1, $array2), array_diff($array2, $array1)); here's demo. for multiple arrays, combine callback , array_reduce : function unique(&$a, $b) { return $a ? array_merge(array_diff($a, $b), array_diff($b, $a)) : $b; } $arrays = array( array('green', 'red', 'blue'), array('green', 'yellow', 'red') ); $result = array_reduce($arrays, 'unique'); and here's demo of that.

c++ - How to efficiently determine the minimum necessary size of a pre-rendered sine wave audio buffer for looping? -

i've written program generates sine-wave @ user-specified frequency, , plays on 96khz audio channel. save few cpu cycles employ old trick of pre-rendering short section of audio buffer, , playing buffer in loop, can avoid calling sin() function 96000 times per second duration of program , simple memory-copying instead. my problem efficiently determining minimum usable size of pre-rendered buffer be. frequencies easy -- example, 8khz sine wave can represented generating 12-sample buffer , playing in looping, because (8000*12 == 96000). other frequencies, however, single cycle of sine wave requires non-integral number of samples represent, , therefore looping single cycle's worth of samples cause unacceptable glitching. for of frequencies, however, it's possible around problem pre-rendering more 1 cycle of sine wave , looping -- if can figure out how many cycles required number of cycles present in buffer integral, while guaranteeing number of samples in buffer integral. e...

php - About displaying posts from two or more blogs -

i want display posts of 2 or more blogs in website using magpierss-0.72 fetching posts , code is require_once('rss_fetch.inc'); $url = 'http://rajs-creativeguys.blogspot.com/feeds/posts/default?alt=rss' /*'http://raghuks.wordpress.com/feed/'*/; $rss = fetch_rss($url); foreach ($rss->items $i => $item ) { $title = strtoupper ($item['title']); $url = $item['link']; $date = substr($item['pubdate'],0,26); //code fetch text $desc = ''; $max = 30; $arr = explode(' ', strip_tags($item['description'])); $l = count($arr); if($l < $max) $max = $l; for($j=0;$j<$max;++$j) { $desc .= $arr[$j] . ' '; } $desc .= '.....'; echo "<div class=\"blog\"><a target=\"_blank\" href=$url><h1>$title</h1>$desc<br/><br/>dated : $date <br/><br/></a></div> "; if($i == 3) break; } here can specify 1 url of feeds , can fetch wa...

math - Calculating the degree of a circle -

say have arc maximum degrees of 60, 0 degrees 60 degrees, , maximum value, 16. want find out degrees of value in relation maximum value. hope made sense, it's quite hard explain. example, have maximum degrees of 80 , maximum value of 40. degrees of value trying find 35, degrees should 70 since 40:80 2, , 35*2 70. part puzzled finding degrees of irrational ratio such 35:78. so seems mistakenly used multiplication instead of division. equation describing ratio of value max value: value / maxvalue = degrees / maxdegrees by rearranging, get degrees = maxdegrees * value / maxvalue

c++ - Temporary object not getting created when exception is caught by reference? -

class error1 { public: int errorcode; error1(int x):errorcode(x){ cout<<"ctor error1"<<endl; } //error1(error1& obj ){ // errorcode = obj.errorcode; // cout<<"copyctor error1"<<endl; //} ~error1(){cout<<"dtor error1"<<endl; } }; void fun() { cout<<"inside fun"<<endl; throw(error1(5)); } int main() { try{ fun(); } catch(error1& eobj) { cout<<"error1 type occured code:"<<eobj.errorcode<<endl; } cin.get(); } output: inside fun ctor error1 dtor error1 error1 type occured code:5 dtor error1 this output indicates error1 object copy constructed catch handler. since copy constructor not defined error1 object default copy constructor used. when uncomment commented section defining copy constructor the following output. inside fun ctor error1 error1 type occured code:5 dtor error1 why 1 dtor getting called? if exception caught reference believe temporary still create...

Applets in Java -

an applet special kind of java program designed transmitted on the internet , automatically executed java-compatible web browser. is homepage of google,yahoo facebook etc. applet ? no. applets downloaded stand-alone programs. google , on use server-side interpreted code sends http response client browsers, different setup.

iphone - assign double to another double with 1 number after the decimal -

this question has answer here: round doubles in objective-c 4 answers i want assign value of double double, print 1 number after decimal, let have random double value , 23.12906370532668 how can converted 23.1 , stay double value?? say: nslog(@"%4.1f\n", double); but printed string want assign new double. double 1 = 23.12906370532668; double 2 = 23.1; best way , how that? am not sure trying do, want double d = 23.12906370532668; nsstring *str = [nsstring stringwithformat:@"%4.1f\n", d]; double d2 = [str doublevalue];

java - Understanding threads and synchronization on a class that spawns the thread -

ok, can 1 explain me gap in knowledge here? initially example below trying synchronize instance method, realised spawn new instance , therefore lock wouldn't happen. so decided make lock on static method of class in hope thread run in order still no luck. can explain error of ways? ( bear me there better ways getting understanding right, i'm php developer going java, love - i'm 2 days in ;-) ) so @ time numbers print out in random order. class 1 package learningjava; public class learningjava { /** * @param args command line arguments */ public static void main(string[] args) { threadcaller ob1 = new threadcaller("this test string 1"); threadcaller ob2 = new threadcaller("this test string 2"); threadcaller ob3 = new threadcaller("this test string 3"); threadcaller ob4 = new threadcaller("this test string 4"); threadcaller ob5 = new threadcaller("this test string 5"); try { ob1.t.join(); ob2.t.join(); ob3.t.join(); ob4....

elisp - How to Save all edited-situations and resume all the situations from the last time when opening Emacs again -

i learned add codes in .emacs can make emacs saves automatically situations before quitting , start next time, emacs can show last situation , go on editing it. (load "desktop") (desktop-load-default) (desktop-read) (add-hook 'kill-emacs-hook '(lambda()(desktop-save "~/"))) but codes makes problem can open 1 emacs, when want start emacs @ same time, previous 1 can run. i want function saving situations next use, need start 1 more emacs, how can 2 sides work simultaneously? thank help. waiting...... use different desktop files; or use emacsclient instead of emacs start new editing buffers once have main emacs , running. there multiple examples in google of emacs alias / function / whatever start emacs if not running, , otherwise run emacsclient .

multithreading - handling multiple threads in java to send request and get response, to a C server application -

i have traditional problem that's living in java development years, couldn't decide best way of doing it. need advice pick best one. issue goes below - client - java program (basically web based application) server - written in c requirement - user upload file may contain million records or example 50000 records. each record (line) have serial id, product name , customer name. java program should read file , send request c application on network. c server application respond request id , in java (client) need store request id in list that's synchronized , should query c server application find out status of request id sent earlier. , server responds either wip (work in progress) or done (completed) request id. if c server application response = done, server send data along response , if wip, client should retry 3 times interval of 5 seconds. code design - step 1 - read file line line step 2 - after reading line, start thread send request server , stores response sync...

c++ - STL set_symmetric_difference usage -

i solving programming problem, wants find symmetric difference between 2 sets. have solved using stl's set_symmetric_difference . given 2 vector<int>s , a , b : a = {342,654,897,312,76,23,78} b = {21,43,87,98,23,756,897,234,645,876,123} sould return (correct answer): { 21,43,76,78,87,98,123,234,312,342,645,654,756,876 } but get: { 21,43,76,78,87,98,123,234,312,342,645,65,756,876} what problem ? here code: sort(a.begin(), a.end()); sort(b.begin(), b.end()); // allocate smallest size of a,b maximum size vector<int> c(a.size() < b.size() ? b.size() : a.size()); vector<int>::iterator i; = set_symmetric_difference(a.begin(), a.end(), b.begin(), b.end(), c.begin()); return vector<int>(c.begin(), i); note: correct answers rest of examples. example gives me wrong answer. i have tested in visual studio, , got error message: "iterator not incrementable" the problem in initialization of vector c . logic wrong in maximum size of outpu...

javascript - How to set div using Z-index and fix css -

area of concern - my blue div overlapping on green div. (i want have green div @ side blue div) on mouseover loaded content making blue div fall down im trying set "mydatatoshow" div on "rightsideblock" using jquery z-index property. kindly have @ , let me know possible solution. my working code --- <!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"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <style type="text/css"> .container{width:999px;} .leftsideblock{float:left; border:1px solid green;width:674px;} .rightsideblock{border:5px solid blue;} </style> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $...

iphone - App is not installing only in 4s device? -

app not installing in 4s device installing in 3g , others.how can solve this? , may know reason this. thanks in advance.... you must add armv6 architecture. see how done: "warning: iphone apps should include armv6 architecture" build config set

c# - How to know the project type programmatically? -

i having file in project. file used other projects. want show messages in file using console console projects, , messagebox windows application projects. so, want know project type programatically.can how achieve this? note: file in c# language. edit: david's answer way have follow. but, near release date. so, need use project type temporary solution. there way that? test if there main windows, if not must in console application : if (process.getcurrentprocess().mainwindowhandle == intptr.zero) { console.writeline(...); } else { // message box code .... }

html - Get navigation menu dropdown to look just like the basic menu items -

i have css menu: http://jsfiddle.net/7jc8t/ if hover mouse on 'inostranstvo' see dropdown open below it. i've been trying failing dropdown items items in horizontal menu. so when user hovers on 'inostranstvo' items show should have: same width (width of widest item), same height , background existing menu items. the background easy, can't force height , don't know how align widths. doesn't anything: #nav li:hover ul li{ height:55px; line-height:55px; width:200px; } the width value random, what's important height, can't seem force on list items. on other hand, adding border works, adds inside red background area. i'm sure can't complicated, can't figure out. have tried set submenu li elements "display-type: block"? i have added following css jsfiddle , seems work: #nav li:hover ul li { display: block; background: #de2211; border-bottom: 1px solid black; }

iphone - Objective-C Sort String Date Array -

i have array consists of dates nsstring . how sort descending? edit : ended tweaking code use nsdate using other methods won't work in case you use sortedarrayusingfunction , consider bellow example nsstring *str1 = @"03-07-2012"; nsstring *str2 = @"01-07-2012"; nsstring *str3 = @"02-07-2012"; nsarray *arr = [nsarray arraywithobjects:str1, str2, str3, nil]; arr = [arr sortedarrayusingfunction:datesort context:nil]; //the date sort function nscomparisonresult datesort(nsstring *s1, nsstring *s2, void *context) { nsdateformatter *formatter = [[nsdateformatter alloc] init]; [formatter setdateformat:@"dd-mm-yyyy"]; nsdate *d1 = [formatter datefromstring:s1]; nsdate *d2 = [formatter datefromstring:s2]; return [d1 compare:d2]; // ascending order return [d2 compare:d1]; // descending order }

javascript - Closure compiler issues with object -

i trying compile js code in google closure compiler , getting error on code var settings = { providers: ['a', 'b', 'c'], interface: 'basic16', apikey: 'xxxxx-xxxxx-xxxxx-xxxxxxxxxx' } errors are jsc_parse_error: parse error. invalid property id @ line 3 character 10 interface: 'basic16', ^ jsc_parse_error: parse error. syntax error @ line 3 character 11 interface: 'basic16', ^ jsc_parse_error: parse error. syntax error @ line 4 character 8 apikey: 'xxxxx-xxxxx-xxxxx-xxxxxxxxxx' ^ but code works perfect me in browser (chrome, firefox, opera, safari, ie7,8,9) the mdn states keyword interface reserved future use , may not used property/function/variable names. https://developer.mozilla.org/en/javascript/reference/reserved_words thing is, mdn states usage of keyword restricted when in strict mode. i'm not quite sure whether closure compiler doing right thing when complains in non-strict mode. looks more bug, ...

php - Using preg_replace to remove unwanted links -

i'm trying remove this: <a href="http://women.domain.com">women.domain.com</a> i thought should be: $this->tresc[$i][description]=preg_replace("/\<a(.*)href=(\"|')http:\/\/women\.domain\.com.*(\"|')(.*)\/\>/i", "",$this->tresc[$i][description]); but doesn't work. for images use , it's working perfectly: $this->tresc[$i][description]=preg_replace("/\<img(.*)src=(\"|')http:\/\/women\.domain\.com.*(\"|')(.*)\/\>/i", "",$this->tresc[$i][description]); $pattern = '(\<a href=["|\']+[http(s)?:\/\/]+([a-z0-9\-]+[.]){1,}+[a-z]{2,4}+[\/]+(.*)+["|\']\>+(.*)+\</a\>)'; $string = "click <a href='http://subdomain.sitename.tld/somedir'>here</a>"; var_dump(preg_replace($pattern, "", $string)); // prints "string 'click ' (length=6)"

NetBeans : How to connect two components , so that they perform the same action? -

i have created jmenuitem , jbutton in jform. there easy way connect them perform same action, using netbeans ide? thank you. use javax.swing.action implement logic (e.g. extending javax.swing.abstractaction ) , assign action menu item and button. both have constructor takes action parameter. enabling/disable action enable/disable button , menu item. see swing tutorial 's chapter using actions more details

mysql - Complex SQL Pivot -

Image
so i've got query selecting data 4 tables: cases taxonomies (containing titles , data taxonomies) taxonomy_values (possible values taxonomies) post_taxonomy_values (holds ids case table, , ids taxonomy table link two) i'm attempting select row cases table , taxonomy names , values. here's i've got far: select cases.title, cases.content, cases.status, taxonomies.title 'taxonomy', taxonomy_values.value 'taxonomy_value' cases, post_taxonomy_values, taxonomies, taxonomy_values cases.slug = 'b-v-dpp' , post_taxonomy_values.post = cases.id , taxonomies.id = post_taxonomy_values.taxonomy , taxonomy_values.id = post_taxonomy_values.value but generates: so i'd take taxonomy names , make them column names, , set values part of returned row. here's structure of tables: cases: taxonomies: taxonomy_values ('taxonomy' references id in taxonomies table): post_taxonomy_values ('taxonomy' references id in taxonomies ta...

jquery - Bootstrap - data-toggle attribute when multiple buttons exist -

i have several buttons. when user clicks button want give him impression button clicked . this code: <table> <thead> <tr> <th><button class="btn btn-danger" >today</button></th> <th><button class="btn btn-danger" >tomorrow</button></th> <th><button class="btn btn-danger" >dayaftertomorrow</button></th> </tr> </thead> </table> and works when have single button: <button class="btn" data-toggle="button">today</button> if user clicks on tomorrow, data-toggle attribute still remains today button. instead, want disable data-toggle attribute when button clicked. you can use bootstraps radio button functionality achieve effect. try this: <div data-toggle="buttons-radio"> <button class="btn btn-danger">today</button> <button class="btn btn-danger">tomorrow</but...

jquery hover tabs , bottom and top row, share central container -

hope well! i've got small project here resolve... …i've been playing , set jsfiddle here illustrate goal required… …i've positioned tab elements top , bottom...top tabs green, bottom tabs red… …the bottom row of tabs in red need different css class need apply different graphic those… ..i've had fiddle unsure of binding accommodate both "moving_bg" class top row of tabs…and "moving_bg-b" class bottom row. …essentially 8 ul blocks of content, need share central container: http://jsfiddle.net/amcbp/ …as can see have correct html structure , css applied, ul blocks don't slide beyond ul block number 4 when using bottom row of tabs. ...as jquery noob assistance, pointers appreciated! the problem : var background = $(this).parent().find(".moving_bg"); you have written animation 1 class .moving_bg top tabs anitmation working perfectly. bottom tab has .moving_bg-b class, no animation placed class. if want us...

c# - SQLite and delete command -

bool ret = false; try { sqliteconnection sqlconn = new sqliteconnection("data source=" + m_dbname); sqlconn.open(); sqlitecommand sqlcomm = sqlconn.createcommand(); sqlcomm.commandtext = "delete " + sztablename+" name="+name+""; sqlitedataadapter sqladapter = new sqlitedataadapter(sqlcomm); if (null == sqladapter) { ret = false; } else { ret = true; } sqlconn.close(); return ret; } catch (sqliteexception sqlex) { console.writeline(sqlex.message); return false ; } i have code delete row in sqlite database, nothing done after click delete button. instead of using dataadapter execute command directly: using(sqliteconnection sqlconn = new sqliteconnection("data source=" + m_dbname)) { sqlconn.open(); //create command sqlcommand.executenonquery(); } you shouldn't swallow exceptions thrown executenonquery method unless can sensibly handle them. should use parameterised queries instead of manually creating queries concatenating ...

2 Level CSS Drop Down Menu - display: none Does not Work -

i have designed 2-level css drop down menu. works perfect except 1 thing. want when hover on top menu item, 1st level drop down menu appears , when hover on item press in 1st level menu 2nd level menu items appear. problem when hover on top menu sub-menus appear altogether. means display: none not work. why happen , solution? jsfiddle.net html code <ul id="nav"> <li><a href="/ueber_uns.htm">about us</a> <ul> <li><a href="#">who are</a></li> <li><a href="#">our goals</a></li> <li><a href="#">our team</a></li> <li><a href="#">press</a> <ul> <li><a href="#">2006</a></li> <li><a href="#">2007</a></li> <li><a href="#">2008</a></li> </ul> </li> <li><a href="#">impressum...

Java: How to aggregate (min,max,avg) of collection element attributes with an expression language approach? -

i looking simple way aggregate functions on java collections determine e.g. minimum price of collection of products. don't want in pure java, kind of dsl / scripting / expression language can entered user , needs simple possible. assume have following object structure: product: id: product1 offers: [offer1, offer2] offer1: id: offer1 data: price: 10.99 shipcost: 3.99 offer2: id: offer2 data: price: 5.99 shipcost: 3.99 in example above end result this: minpriceofproduct1 = 5.99 now user of application can display list of products. each product wants minimum price minimum of offers. user not have access underlying datastore, sql not option. thing have java objects. user use kind of expression language exress this. currently have ability apply snippet of freemarker code each product data or bit more compute new values based on attributes this: <#if (item.isproduct() && item.offers??) > <#assign offerminprice = -1> <#list item.offers o> <#if (offerm...

javascript - jQuery - Link after .animate -

i'm trying make code follow link after animation has run. the idea "gnoll" hits button , send link. this code far: it has not link inside it. (also, button color supposed change halfway through "hit" animation. far have failed on one) $(document).ready(function(){ $('.homebutton').click(function(){ $('.animateme').html('<img src="construct2/images/gnoll_running.gif" />'); $('.animateme').animate({ left: '+=150', }, 800, function() { $('.animateme').html('<img src="construct2/images/gnoll_hit.gif" />'); }); $('.animateme').animate({ left: '+=0', }, 500); $('.animateme').animate({ left: '+=0', }, 500, function() { $('.animateme') .html('<img src="construct2/images/gnoll_resting_smaller.gif" />'); }); }); $('#addonbutton').click(function(){ $('.animateme').html('<img src="construct2...

php - How to make a field optional in faccebook registration plugin -

i have following code facebook registration social plugin: <iframe src="https://www.facebook.com/plugins/registration? client_id=xxxxxxxxxxxxxxxx& redirect_uri=http://www.pingxxxxxx.com/facebook_registration_plugin/fbwe/trial.php& fields=[ {'name':'name'}, {'name':'email'}, {'name':'location'}, {'name':'gender'}, {'name':'birthday'}, {'name':'about', 'description':'about youtself', 'type':'text'}, ]" scrolling="auto" frameborder="no" style="border:none" allowtransparency="true" width="100%" height="330"> </iframe> i want make last field i.e "about" optional user . field {'name':'about', 'description':'about youtself', 'type':'text'}, can tell me how can done ? to make field optional, can use no_submit pa...

database - INSERT python list into MySQL DB -

i got code not getting working listdata = [1, 2] listdata1.insert(1, raw_input("enter first thing db: ") listdata2.insert(2, raw_input("enter second thing db: ") then make db, then cursor.execute("insert testdb (table, table) values (%s, %s)", (listdata1, listdata2 which gives me: nameerror: name 'listdata1' not defined is inserting possible way? or how work? the problem happens here: listdata1.insert(1, raw_input("enter first thing db: ") you did not define variable listdata1 yet. change listdata , fix nameerror. besides, can append instead of insert e.g. listdata.append( raw_input("enter first thing db: ") ) then raw input kept in position 0 in listdata, , can retrieve listdata[0] the sql looks wrong ('table' appear twice)

SVN server setup on ubuntu small query -

i had setup subversion repository on server. when add file working copy , commit it, says committed successfully. when access repository location url shows me files there when log in via ssh , in repository folder file not there. for example: on following url see list of folder , file in repository http://ec2-23-23-213-14.compute-1.amazonaws.com/myproject/ but ssh when in /www/myproject/ find following files readme.txt, conf, db, format, hooks, locks, project1 "project1" initial import. is or had made mistake in setting svn. thanks in advance. svn stores files, differences, properties, revisions, etc. in database. don't expect find files directly under repository folder. if can access repository via svn client, , if runs expected, server going well.

installing pyopenssl on ios -

when type: easy_install pyopensll results are: davie:~ root# easy_install pyopenssl searching pyopenssl reading http://pypi.python.org/simple/pyopenssl/ reading http://pyopenssl.sourceforge.net/ reading http://launchpad.net/pyopenssl best match: pyopenssl 0.13 downloading http://pypi.python.org/packages/source/p/pyopenssl/pyopenssl- 0.13.tar.gz#md5=767bca18a71178ca353dff9e10941929 processing pyopenssl-0.13.tar.gz running pyopenssl-0.13/setup.py -q bdist_egg --dist-dir /tmp/easy_install-fadtsb/pyopenssl-0.13/egg-dist-tmp-bvjmgv warning: no previously-included files matching '*.pyc' found anywhere in distribution in file included openssl/crypto/crypto.c:14: /usr/include/python2.5/python.h:18:20: error: limits.h: no such file or directory /usr/include/python2.5/python.h:21:2: error: #error "something's broken. uchar_max should defined in limits.h." /usr/include/python2.5/python.h:25:2: error: #error "python's source code assumes c's unsigned char 8-bit...

html5 - cross origin video does not load in Chrome -

i trying video crossorigin attribute play in chrome (version 20.0.1132.47 m). not load. network panel shows options (so called "preflight") request gets aborted browser reason.it works without crossorigin attribute. firefox loads , plays successfully. appreciate suggestions. <video id='vid' autoplay crossorigin src='http://videos-cdn.mozilla.net/serv/mozhacks/demos/resources/immersivevideo/dubai.r.webm'> </video> http://jsfiddle.net/zvgr2/ the cause of turned out missing access-control-allow-headers response header list of http headers matches list passed in access-control-request-headers request header.

c# - How to loop xmlnodes in parallel -

i have following code: foreach (xmlnode xn in xnlist) { string name = xn["name"].innertext; } i want launch each loop in parallel. how can this? thought use following method, can't figure out way make work: paralleloptions paroptions = new paralleloptions(); paroptions.maxdegreeofparallelism = 4; //only 5 threads allowed. parallel.foreach(xnlist.asenumerable(), paroptions, xn=> { string name = xn["name"].innertext; } what tried done below: parallel.foreach(xnlist.asenumerable(), item=>{string name = item["name"].innertext;}); but if using winform , want processes , preventing waiting cursor, problem.

compiler construction - What is the purpose of a lexer? -

i reading answer this question. can't seem find answer why need lexer separately is 1 of steps program goes through during compilation? can please explain in simple terms why need lexer, , purpose serve? a lexer take input character stream , convert tokens. this can used variety of purposes. apply transformations lexemes simple text processing , manipulation. or stream of lexemes can fed parser convert parser tree. if goal compilation, lexical analysis first step. think of lower level step takes characters , converts them tokens. parser higher level mechanism alphabet consists of tokens (created lexer), parses , creates parse tree. if goal text manipulation, manipulation rules can applied lexemes themselves.

java - Installing Vertica JDBC jar file in WIndows 7 -

having trouble installing vertica_5.1.1_jdk_5 on windows 7 pc. installed latest java sdk. when type java -jar vertica_5.1.1_jdk_5.jar, "no main manifest attributes". opened manifest file within jar, , found "manifest-version: 1.0 created-by: 1.5.0_07 (sun microsystems inc.)". i've read, i'm missing main class statement in here. how figure out add manifest file? a jdbc driver library used java application. not program itself, doesn't have main-class attribute, , therefor cannot run trying do.

java - How to use RESTEasy PreProcessInterceptor only in specific methods? -

i'm writing rest api, making use of resteasy 2.3.4.final. know interceptor intercept of requests, , preprocessinterceptor first (before everything) called. know how can make interceptor called when specific methods called. i tried use both preprocessinterceptor , acceptedbymethod, not able read parameters need. example, need run interceptor when method called: @get @produces("application/json;charset=utf8") @interceptors(myinterceptor.class) public list<city> listbyname(@queryparam("name") string name) {...} to more specific, need run interceptor in methods have @queryparam("name") on signature, can grab name , before everything. is possible? tried catch "name" parameter inside interceptor, not able that. could me, please? you can use acceptedbymethod explained in resteasy documentation create class implement both preprocessinterceptor , acceptedbymethod . in accept -method, can check if method has parameter annotated @que...

python - iterate over a list with some conditions -

i have 2 lists, valid , locations . valid contains ids represented string numbers, , location contains id + strings (path) belonging id follow. my goal check if id part of valid group. if true valid id , following items call functions. when inavlid id detected should skip , move item next id. my code goes this: valid = ['1', '2', '3', '4', '5', '6', '27', '28', '29'] locationlist = ['1', '1_path1','1_path2','1_path3','2', '2_path1','2_path2','2_path3', '55','55_path1','55_path2', '3', '3_path1' ] item in locationlist: if len(item)< 3: if item in valid: print "###########lib id found in item %s############" %item print "call bring file name function - %s" %item continue else: continue print "call fix path function - %s" %item print "call search file function -%s" %...

url rewriting - Amazon Route 53 setup and 301 Redirection setup -

i've setup site on amazon ec2 server. using route 53 , servers dns have propagated correctly when set them on godaddy. have few problems. @ end results want make 301 redirect www non-www (from www.domain.com domain.com). want redirection applicable paths (ie. www.domain.com/folder/ domain.com/folder). in current configuration i've setup record domain.com point elastic ip address i've assigned server. when put domain.com (without www) in url works great , site loads. i've setup www.domain.com record point same ip address. in iis7.5 i've set redirection rule (after i've installed "url rewrite" iis module. here's rule: request url: matches pattern using: wildcards pattern: (.*) logical grouping: match input {http_host} type: matches pattern pattern: www\.mydomainname.com\.com action type: redirect redirect url: mydomainname.com{r:1} redirect type: 301 when run site 'www' returns www.mydomain.com/mydomain.commydomain.commydomain.com ,etc....

sql - Postgres using the primary key index as a covering index -

i'm wondering if, in postgres, there downsides piggybacking fields index implicitly created primary key in order not have create more indices. this common technique in creating clustered indices in sql server. edit good article on postgres indexing. seems postgres indexing dynamics different sql server. no not possible. postgresql cannot "include" columns without making them "active" in index. currently postgresql not support index scans. included in upcoming 9.2 release though. but adding columns index don't need might impose performance penalty updates because non-indexed column more efficient update indexed column.

Sql filtering id's -

i want create sql query lets me make top 5 of used ids in table. table has these columns: reservationid costumerid roomid hotelid i'm trying top 5 of used hotel ids. i thought had use count function doesn't seem work. counts hotelids , doesn't see difference between id's select count(hotelid) reservation; can me push me in right direction? thanks in advance! select count(`hotelid`) `freq`, `hotelid` `reservation` group `hotelid` order `freq` desc limit 5 ;

Random error: #1045 Cannot log in to the MySQL server -

ive had mysql , running month now. using yesterday, , today go login via phpmyadmin , command line , can't. if changed password overnight or something. im trying login using root user. do? edit this mysql running on local laptop development. account on root account, , no caps lock not on. http://www.cyberciti.biz/tips/recover-mysql-root-password.html says 5 step process work, try @ own risk obviously . source has same steps. won't work on windows, similar should http://www.debian-administration.org/articles/442 stop mysql service using /etc/init.d/mysql stop start mysql without password using mysqld_safe --skip-grant-tables & connect server using mysql -u root change root password: mysql> use mysql; mysql> update user set password=password("new-root-password") user='root'; mysql> flush privileges; mysql> quit stop server: /etc/init.d/mysql stop start server: /etc/init.d/mysql start test: mysql -u root -p

jquery - How to achieve effect used on http://www.googleventures.com/? -

i need recreating effect found on http://www.googleventures.com/ wanting make header , content slider on website stays in place rest of page scrolls on it. how can this? appreciated! though might possible parallax, cannot figure out how it...please help! here go, http://jsfiddle.net/xbxhd/1/ the top div can have links etc. on google ventures, not image. idea :)

Cmake flags for debugging don't seem to be useful in valgrind? -

ok, have qt application i'm attempting debug; upon running valgrind on , redirecting output file, see many 'definitely lost' blocks this, make me sad: ==24357== 24 bytes in 1 blocks lost in loss record 150 of 508 ==24357== @ 0x4c2c56f: malloc (vg_replace_malloc.c:267) ==24357== 0x76ed3ca: fcpatterncreate (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.4.4) ==24357== 0x76eb3cd: fcfontrenderprepare (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.4.4) ==24357== 0x76eb66c: fcfontmatch (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.4.4) ==24357== 0x57163d7: qfontdatabase::load(qfontprivate const*, int) (in /usr/lib/x86_64-linux-gnu/libqtgui.so.4.8.1) ==24357== 0x56f3586: qfontprivate::engineforscript(int) const (in /usr/lib/x86_64-linux-gnu/libqtgui.so.4.8.1) ==24357== 0x5728482: ??? (in /usr/lib/x86_64-linux-gnu/libqtgui.so.4.8.1) ==24357== 0x573b73d: qtextline::layout_helper(int) (in /usr/lib/x86_64-linux-gnu/libqtgui.so.4.8.1) ==24357== 0x573d5a4: qtextlayout::endlayout...

c - raw socket. ip header when to use hton -

i new raw socket, , playing around ip header. noticed ip->ip_hl = sizeof(struct ip) >> 2 //works fine; ip->ip_hl = hton(sizeof(struct ip) >> 2) //will not work; what dont understand why not convert numbers network order instead of host order in case? what's general rule judge when use network order/host order? thanks htons 16-bit values. htonl 32-bit values. hton (no suffix), i'm not sure exists. the header length occupies 1 byte (actually part of 1 byte). don't need flip bytes right form. accordingly, there no macro htons or htonl 8-bit values.

php - What is the fastest way to check if files in a folder exist in my mysql database? -

i want scan folder of effects , check if each file listed row in mysql database of effects, , if isn't show un-tracked file. know efficient method achieve php? thank much. i think there's 1 way: glob directory, prepare 2 statements (a check , update) using pdo or mysqli , loop through files. if need on regular basis, should move tracked files different place track / check them.

php - How to optimize query with table scans? -

this far slowest query in web application. select prof.user_id userid, prof.first_name first, prof.last_name last, prof.birthdate, prof.class_string classes, prof.city, prof.country, prof.state, prof.images, prof.videos, u.username, u.avatar, (select count(*) company_member_sponsorship member_id = prof.user_id , status = 'sponsored') sponsor_count, (select count(*) member_schedules user_id = prof.user_id) sched_count member_profiles prof left join users u on u.id = prof.user_id order ( prof.images + prof.videos * 5 + ( case when prof.expire_date > :time 50 else 0 end ) + sponsor_count * 20 + sched_count * 4 ) desc, prof.last_name asc limit :start, :records everything else on site takes less second load lots of queries happening on levels. 1 takes 3-4 seconds. it's table scans causing slowdown. can understand why; first table has 50,000+ rows, second 160,000+ rows. is there way can optimize query make go faster? if worse comes worst can go through code , maintain ta...

How do you append to a Hive array? -

i have hive table user id have ts column, timeseries, stored array. want maintain timeseries recentmost window. (a) how append new number end of each column table joined id? (b) how drop leading number? data in hive typically stored in hdfs. hdfs has limited append capabilities. if constant modification of data @ core of analytics systems, perhaps should consider using alternatives hbase or cassandra. however, if data updates small part of workflow, encourage continue using hive (in order make use of it's sql functionality) reconsider design storing these updates. a quick solution above problem have more 1 record per user id in table. each record have timeseries corresponding user id. when want last n analysis on timeseries, should select table using distribute by on user id column. custom reducer pick out last n (or less, if size of timeseries less n) timestamps , return them. harish butani did work on windowing functions in hive. can take @ his work , associated docume...

Google Celebrity Search Result API? -

Image
i found in google, when type celebrity's name in search bar, there side bar portrait photo of celebrity, brief description , other related information , related people. wondering if wrapped in api provided google, since app need collect sort of information (we use wiki api). give me link or suggestion it? and/or maybe other api gives similar information?(i compare result) in advance. google celebrity search result api? - stack overflow stack overflow questions developer jobs documentation beta tags users current community help chat stack overflow meta stack overflow communities sign up or log in customize list. more stack exchange communities company blog tour start here quick overview of site center detailed answers questions might have meta discuss workings , policies of site learn more stack overflow company business learn more hiring developers or posting ads ...