Posts

Showing posts from June, 2010

html5 - Why cant we use <wrapper></wrapper>? -

i can use <section id="wrapper"></section> , because i'm pedantic, there wrong using <wrapper></wrapper> html element? i'm using html5 shiv , modernizer, work fine wanted know if there's particularly wrong doing way. <section> elements represent section in page, not your layout . important , confused of starters in html5 including me. let me show wrong, using example: <section id="banner"> </section> banners part of layout not web content. not have section. have represented <div> used in html 4. <section id="wrapper">...</section> is wrong in same way, because wrappers purely layout specific tasks, not represent specific content on page. <sections> should represent differentiated content , not others. here example of html5, can considered valid. <div id="wrapper"> <section id="mainarticle"> </section...

jQuery - I am not getting the right child -

so trying fake .click() event on first <a> within .glossnav within specific .words when click .letter . here have tried: $(".letter").click(function(){ var whichletter = $(this).children("span").text(); var selectedgloss = "#glossary-" + whichletter; $(".words").fadeout(200); $('.letter').removeclass('underline'); $(selectedgloss).delay(200).fadein(200); $(this).addclass('underline'); if($(selectedgloss).children(".glossnav").length > 0) // there isn't nav. { alert("yippee!"); $(selectedgloss).children(".glossnav").first().click(); } }); the "yippee!" alerting. here nav html (this glossary im building): <div id="modelglossary"><div class="letterbar"> <a href="javascript:void(0)" class="letter" id="selector-a"> ...

javascript - Video source in conditional expressions -

i'd know how write condition includes video source parameter(i'm using html5 , javascript). for instance, if video1 playing (or loaded) , user presses 'w' key video2 plays. if(v.src=="video1.webm" && key_press=="z") { v.src="video2.webm"; v.play(); } but " v.src=='video1.webm' " doesn't seem work. how can use expression in condition? thanks in advance! you must reload before playing it, if update video source, if (v.src=="video1.webm" && key_press=="z") { v.src="video2.webm"; v.load(); v.play(); }

c# - Sum of Columns of Two Tables in LINQ -

i have 2 related tables in ms sql. example... table – room roomid roomcost table b – roomitem roomitemid itemname itemcost roomid i need in writing linq code add roomcost sum itemcost (if have same roomid) , post results in wpf textbox. far have tried dataclassesdatacontext dc= new dataclassesdatacontext(); var roomamount = (from dbo in dc.room select dbo.roomcost).single(); var itemamount = (from itm in dc.roomitem select itm.itemcost).single(); decimal rmamount = convert.todecimal(roomamount); decimal itmamount = convert.todecimal(itemamount); decimal tamount=rmamount+itmamout; txttotalamount.text=tamount i beginner in c#, kindly help. if haven't been clear enough, ask. how using sum() (havent tested it): assuming room.roomcost decimal , roomitem.itemcost decimal , myroomid id of room want sum up: var roomamount = dc.room.single(r => r.roomid == myroomid).roomcost; var itemamount = dc.roomitem.where(i => i.roomid == myroomid).sum(r => r.ite...

gorm - Grails, querying self-referencing table -

i have table self-referencing field: class book{ integer id string name book version } when add books without "version", version field null have query book table records don't have version (their version field null), following code won't work: def results = book.withcriteria{ eq("version", "null") } but i'm getting exception: org.hibernate.propertyaccessexception: illegalargumentexception occurred calling getter of book.id what query should use? version keyword in gorm used optimistic locking. modify domain , criteria below make criteria return appropriate results. //domain class book { integer id string name book bookversion } //criteria def book = new book(name: "test", version: null) book.id = 1 book.save(flush: true) def results = book.withcriteria{ isnull("bookversion") } assert results && results[0] instanceof book also note, bookversion ...

sql server - How to convert text column to datetime in SQL -

i have column that's text: remarks (text, null) a sample value "5/21/2013 9:45:48 am" how convert datetime format this: "2013-05-21 09:45:48.000" the reason conversion trying total number of hours between datetime column , date stamp in remarks column. thinking of this: remarks (text, null) - date_sent (datetime, null) to clear, columns represent datetime inquiry customer sent (date_sent) , last response made representative regarding inquiry (response), sample of date_sent having value of "2013-05-21 08:00:00.000" , response value of "5/21/2013 10:00:00 am", should value of 2.00 (2 hours). unfortunately, in database i'm working on, remarks text , date_sent datetime. i'm kind of new sql, need on :( tia! use convert style 101. select convert(datetime, remarks, 101) if column text need convert varchar before converting datetime select convert(datetime, convert(varchar(30), remarks), 101)

ios5 - Remove notification observer in superclass or subclass in ios -

i have registered notification in superclass. observer handled in subclass calls super implementation. remove observer in dealloc of superclass or subclass ? you should removing observer same class registered notification.

Mirc code to Spell check before adding variable -

on *:text:@btag*:#: { if ( ## isin $2 ] { set %tag. [ $+ [ $nick ] ] $2 { describe # $nick has saved battletag } else { describe # $nick $+ , please enter real btag } } this code have. what require code @ text , save variable if contains symbol (#) hash tag. i finding hard code hashtag (#) part of coding language... lmk guys can me '#' char in mirc remote code evaluate channel event fired from. when want express explicitly hash tag character should use $chr(35), 35 hashtag ascii number. the code below check: if in channel user wrote @btag some-text-contains-#-char , if so, save inside tag-user variable word contained #hash tag. send him has saved... else send him nick, please enter.. code on *:text:@btag*:#: { if ($chr(35) isin $2) { set %tag. [ $+ [ $nick ] ] $2 describe # $nick has saved battletag } else { describe # $nick $+ , please enter real btag } } the code isn't perfect , work ...

ruby on rails - How to query multiple columns against a single array of ids -

i have following model: message.rb: sender_id, receiver_id, created_at i find messages sender_id , receiver_id both within array of ids [1,4,41,543,312,62,234]. group messages pair (sender_id & receiver_id) ordered created_at. is right way write query? looking optimal solution here... message.where("sender_id in ? , receiver_id in ?", @ids) thanks try:- message.where("sender_id in (?) , receiver_id in (?)", @ids, @ids).order("created_at asc")

mysql, select, many to many, join tables. ordering by a field -

i have dictionary table: 'kws' [kws.wrd][kws.kwid] (word , unique id) have many many relation in: kwds table [kwds.kwid][kwds.linkid][kwds.weight] (keyword id*, link id*, weight), may keywords , many links, , weight of keyword link page. have links table 'lnks' [lnks.url][lnks.txt][lnks.siteid] have site table 'wss' [wss.siteid][wss.logo][wss.serverip] sql search page is: select distinct(lnks.linkid),wss.name,wss.logo,wss.srvip, lnks.linkid,lnks.title,lnks.dsc,lnks.name,lnks.url,lnks.txt, lnks.siteid,kwds.wg lnks join kwds on (kwds.linkid=lnks.linkid , kwds.wg>0) join kws on (kws.kwid=kwds.kwid) join wss on (wss.siteid=lnks.linkid) kws.kwid in (396,416,399) order kwds.wg limit 0, 8 where 396,416,399 pre-fetched keywords ids dictionary table 3 variant words criteria. query not order weight. doing wrong. the real query can seen @ code.google.com/p/mitza @ demo link... 209.* tables using can seen @ same locatio...

java - Keyboard not showing up with scrollView in webView android -

i have webview inside scrollview <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="match_parent" android:background="@android:color/white" android:orientation="vertical" > <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/bg_header" /> <scrollview android:layout_width="fill_parent" android:layout_height="match_parent" > <webview android:id="@+id/webview" android:layout_width="wrap_content" android:layout_height="wrap_content" ...

jvm - How to properly use Drip with java application? -

i not java expert need execute jar file within python , capture output. using nailgun stumbled upon drip supposed better nailgun ( https://github.com/flatland/drip ). from docs it's java command replacement, , on second run should run lot faster. however see no difference.. has experience drip or knows i'm doing wrong? here times 2 commands: time java -jar re.jar -s 1364799600 -e 1364835205 -f data/sampledata.json real 0m0.532s user 0m0.624s sys 0m0.116s time drip -jar re.jar -s 1364799600 -e 1364835205 -f data/sampledata.json real 0m0.657s user 0m0.744s sys 0m0.124s

iphone - Deleting core data element at specific position. -

im new xcode , iphone application please bare me. im trying delete selected core data element in table view when "edit" "delete" button pressed. can't seem though. last method deleting should go. method being called when delete button pressed keep getting error "no visible @interface @ "webbrowser" declares selector "deleteobject" here part of code. #import "webtableviewcontroller2.h" #import "webbrowser.h" #import coredata/coredata.h #import "editviewcontroller.h" @interface webtableviewcontroller2 () @property uimanageddocument *webdocument; @property nsfetchedresultscontroller *resultscontroller; @end @implementation webtableviewcontroller2 - (id)initwithstyle:(uitableviewstyle)style { self = [super initwithstyle:style]; if (self) { // custom initialization } return self; } - (void)viewdidload { [super viewdidload]; nsstring *filename = [[nssearchpathford...

c# - Switch case with Boolean -

i trying create prefix text value project. using switch case that. when user select relevant radio button should give prefix value. what should give after "switch ()" the value coming user selection boolean value. output string. any help.. public string officepostfix() { string postfix = null; switch (...) { case sheetmgrform.goldcoast = true: postfix = "qld"; break; case sheetmgrform.melbourne = true: postfix = "mel"; break; case sheetmgrform.sydney = true: postfix = "syd"; break; case sheetmgrform.brisbane = true: postfix = "bis"; break; } return postfix; } that's not how switch works. can't put arbitrary boolean expression in each case (assuming mean == , not = , btw). you need use set of...

jquery - how to show multiple alerts in html web page using javascript -

i have web page in there check button if 1 button selected shows 1 alert , if 2 should show 2 alerts shows alert 1 of button selected first . i using following code $(document).ready(function(){ $("#email_multiple").click(function(){ var n = $("input:checked").length; //alert(n); //for(var i=1;i<=$("input:checked").length;i++){alert(n);} if(!($("input:checked").length)){ alert('please make check on check box field hahahahha...'); return false; } if(n==1){ var bb = $("input:checked").val(); alert(bb); presenter.command("emailsend",{ "toemail": "", "toname": "", "subject": "", "body": "single attachment", "bodyhtml":"", ...

exception - Is cache miss a kind of interrupt/fault -

we know page miss in memory bring page fault, , page handler must load page physical memory. here wonder whether miss in cache system fault? if not, what's difference between memory fault , cache fault? lot. by "cache fault" mean cache miss in l1/l2/l3 caches of processor? if so, no, not generate fault, @ least on every processor architecture i've ever heard of. the reason page fault requires software intervention decide whether access invalid, whether access page swapped out disk, etc. in contrast, cache miss can definition handled processor - since didn't cause page fault, data must stored in main memory or lower-level cache, directly accessible processor. processor mechanically translate address of memory being accessed virtual physical , asks lower-level cache or main memory data. the same idea applies simultaneous multiprocessors, cache line might invalidated 1 core writes it, though core has stored in cache. processor defines own coherency ...

ios - Overriding drawRect method in a UIView subclass & call it into another UIViewcontroller -

i novice ios programmer , first project.i going develop project ipad. in project need draw several circles & display data on parsing xml element.i have done the circle drawing part subclassing uiview class , overriding drawrect method. load uiview subclass in uiviewcontroller via loadview method .now need touch circle , switch uiviewcontroller. i not sure how switch uiviewcontroller because of drawing , touch detecting code in uiview subclass. a appreciated you need use delegate method tell parent view controller there touch, can present view controller. at top of uiview subclass header, add this: @protocol mycustomviewdelegate <nsobject> - (void)customviewcircletapped; @end then, in declaration of view (the existing declaration have of custom view subclass): @interface mycustomview : uiview ... @property (weak) id<mycustomviewdelegate> delegate; after that, in view controller, need set view.delegate = self , view can reference view...

nhibernate mapping generator integrated to build -

i have searched automatic mapping generator nhibernate. far have tried following nhibernate mapping generator devart entity developer codesmith generator from nhibernate mapping generator 1 supports nh style fluent mapping default. devart , codesmith provides possibility write own templates job. devart , codesmith has "challenges", when want mappings , entities located in different assemblies. i ask, if guys have experience tools above? if have other tools suggest me. i interested in integrating tools ci environment. whenever db changes, want entities , mapping generated automatically. i use devart entity developer , support fluent nhibernate mapping. in-fact use on of projects. add fluent template provided , configure output location. generates mapping code files automatically based of model load in database every time build project. integrates visual studio if required. thoroughly recommend give 30 day trial ago. devart entity developer in pa...

Android-Query(AQuery) is used for SQLite Databse? -

i want fetch data sqlite database using aquery. don't have idea that. so, possible fetch data database using aquery?? if yes, how ? aquery not designed accessing local database. can try orm, sprinkles or ormlite.

c - Arranging 3 numbers in ascending order - function not working as expected -

as part of bigger problem have sort 3 numbers in ascending order. simple enough task, reason i'm not getting expected result. using arrays not allowed. please let me know if can tell problem is. i've been racking brains , can't see :< thank you! #include <stdio.h> void order(int a, int b); int main(void) { int x, y, z; scanf("%d %d %d", &x, &y, &z); order(x, y); order(x, z); order(y, z); printf("%d %d %d", x, y, z); return 0; } void order(int a, int b) { int inter; if(a > b) { inter = a; = b; b = inter; } } you passing numbers x, y, , z value. swap in order() not reflect in main(). instead pass address of variables , modify them original variables in main() reflect changes did in order(): #include <stdio.h> void order(int *a, int *b); int main(void) { int x, y, z; scanf("%d %d %d", &x, ...

jpa - unable to update entity -

this method public string changepassword(int id){ facescontext context = facescontext.getcurrentinstance(); try{ utx.begin(); wuser wuser= em.find(wuser.class, id); wuser.setpassword(passwordv); utx.commit(); return "login"; }catch (exception e) { facesmessage message = new facesmessage(facesmessage.severity_error, "error changing password! ", "unexpected error when changing password account. please contact system administrator"); context.addmessage(null, message); logger.getanonymouslogger().log(level.severe, "unable change password ", e); return null; } } ...

Android Adding OnClickListener to listview -

i have been trying create settings app new rom called "prototype" , trying add onclicklistener listview cant find appropriate way , result have turned here , wondering if can show me how i'll post activity below , thanks. package fr.xgouchet.tuto.switchpreferences; import java.util.arraylist; import java.util.list; import android.preference.preferenceactivity; import android.widget.listadapter; public class myprefsactivity extends preferenceactivity { private list<header> mheaders; protected void onresume() { super.onresume(); settitle("settings"); if (getlistadapter() instanceof myprefsheaderadapter) ((myprefsheaderadapter) getlistadapter()).resume(); } protected void onpause() { super.onpause(); if (getlistadapter() instanceof myprefsheaderadapter) ((myprefsheaderadapter) getlistadapter()).pause(); } public void onbuildheaders(list<header> target...

c# - asp.net mvc4 project compiles ok but gives the yellow screen of death -

looks i'm not 1 issue visual studio 2010 not catching compile errors on build http://social.msdn.microsoft.com/forums/en-us/vseditor/thread/423387c5-1649-4517-996a-fb6405ea7af0/ getting weird error here i created brand new mvc4 .net 4.5 project in vs2012 added nuget packages, added classes couple of test projects changed namespaces, compile, run project , voila ysod message saying method... not available on class .... i have tried following no avail clean project, rebuild , run debug again restart vs2012 reboot machine apply windows update run vs2012 project in question it appears while there's no compiler error, there's no intellisense atleast on ef model types ! hopefully there's rational explanation ! update - specific error is compiler error message: cs0117: 'mysite.myusertype' not contain definition 'getfor' where getfor() static method on type myusertype, in partial class, both partial files in same project, both h...

objective c - DDMathParser - Using a string as an argument in a custom function -

i make function allow me pass string in argument - what's best way this? eg.. moles("ca(oh)2") any extremely gratefully received. i ended putting in parsing strings variables. ddmathparser: somefunction("hello") ... equivalent to: somefunction($hello) however, means can have variables more complex stuff: somefunction("hello world") moles("ca(oh)2") ... etc

hyperlink in visual basic excel -

what want in code when click cell b3 in sheet1 direct me a5 in sheet2 vice versa, when click a5 in sheet2 bring me b3 in sheet1 http://i.stack.imgur.com/qungd.jpg sub macro3() ' ' macro3 macro ' ' range("b3").select activesheet.hyperlinks.add anchor:=selection, address:="", subaddress:= _ "sheet2!a5", texttodisplay:="gg" sheets("sheet2").select activesheet.hyperlinks.add anchor:=selection, address:="", subaddress:= _ "sheet1!b3", texttodisplay:="gg" sheets("sheet1").select end sub now problem if name of sheet userdefined? there's messagebox says should input name of sheet. sub address changes not "sheet2" anymore. instance put in msgbox "123", name of sheet become "sheet2 123". you should take advantage of indexing of worksheets collection. sub indexingsheets() sheets(1).range("b3").form...

c - maximum number of variables in private() clause in OpenMP -

i want know whether there limitation on number of variables can defined in private() clause in openmp. i have code has 4 loops lot of variables. outermost loop can parallelized using pragma. inner loop can parallelized using pragma. using 1 pragma @ time. (either outermost or innermost) of course, using pragma in innermost loop not advisable because overhead of thread creation because of 3 loops above it. put pragma correctness test purposes. #pragma omp parallel private(var1,var2,...i,k,l) for(j = ...) { int var1; int var2; (i = ... ) { ... for(k = ... ) { ... for(l = ... ) { ... ... } } } } or for(j = ...) { int var1; int var2; (i = ... ) { ... for(k = ... ) { ... #pragma omp parallel private(var3,var4) for(l = ... ) { int var3; ...

Notepad++ extra newline -

i have c app logs file. i installed monitor plugin notepad++ automatically update, similar 'tail' on linux. my app writes lines \n\r @ end ( e.g. fprintf(fp, "%s\n\r","test"); ) i like: line 1 line 2 instead of line 1 line 2 when viewing (no matter eol conversion) 'view->show symbol->show end of line' see: line 1[cr][lf] [cr] line 2[cr][lf] [cr] it if treating \n [cr][lf] , \r [cr] adding line. any ideas? try using \n. windows sees \n new line \r carret return causes break line, if u use \r\n cause 1 line break. also can check this article additional reading.

Entity Framework: check if object exists and check if it has an associated object -

in many-to-many relationship between file , category want check if file exists , if so, if has categories (because there's chance may not have any) : public bool existsindbandhascategories(string path) { using (winfilecontextcontainer c = new winfilecontextcontainer()) { return c.file.any((o => o.path == path)); } } this checks if file path has record in database. got thread on site. truth told still not linq , lambdas, don't know how extend give me boolean categories well. in advance time. you have add condition method (assuming have defined categories list of category in file class) : return c.file.any((o => o.path == path && o.categories.any()));

sql - How to get the records in last 24 hrs when the query is run at 00:05 hrs -

how records in last exact 24 hrs? select * table1 sentdate >= sysdate - 1 when ran above query @ 00:05 hrs, returning records in last 5 minutes. need fetch records in last exact 24 hrs when query run. how can achieved in sql/oracle there way similar to select * table1 sentdate >= sysdate - 24 hrs ? running @ 5 minutes past suggests you're looking "yesterday", be: sentdate >= trunc(sysdate)-1 , sentdate < trunc(sysdate) if want exact last 24 hours then: sentdate >= sysdate-1 , sentdate < sysdate or: sentdate > sysdate-1 , sentdate <= sysdate be careful of boundary conditions, hence using >= , <, or > , <= in above.

backbone.js - Where to use event aggregator in backbone marionette? -

i want implement custom vent event aggregator instance requirejs explainer here looking @ examples here , in docs, i've seent calls vent.on , vent.trigger used in views. pattern be: define(['marionette', 'vent'], function (marionette, vent) { return marionette.itemview.extend({ initialize: function () { //bind this.listento(vent, 'mycustomevent', this.mymethod); //trigger vent.trigger('viewinit', ...); } }); }); is pattern correct (views responsible managing aggregator events) or should use on models , collections? the event aggregator pub/sub system communication. regarding "what should go where", i'd suggest following in cases: views trigger events (according user has clicked, e.g.) controllers listen , react events (deleting model, e.g.) of course, there many ways use event aggregator, when dealing views, above method fits use cases. usi...

javascript - 2 tables columns interchange draggable and droppable -

i want interchange columns in 2 tables.if "a" selected , dragged "1" should move automatically. http://jsfiddle.net/9lgrm/ <table id="a"> <tr> <td>a</td> <td>b</td> <td>c</td> <td>d</td> </tr> </table> <table id="b"> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> </tr> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> </tr> </table> i have tried plugin. http://www.danvk.org/wp/dragtable/ https://github.com/jebaird/dragtable it uses single table cant change structure of table! here solution . the html: <table class="dragga...

css - How to make search field responsive -

i'm attempting add search field responsive sidebar, , want field responsively scale width of sidebar, while keeping 'submit' button @ set width, on same line search field. i've been able mock effect divs, when applying same styles form elements, search field fill full width of form element: http://dabblet.com/gist/5618200 i aware can work percentages: http://dabblet.com/gist/5618209 but 'submit' button have set width. what can make form behave -exactly- div mockup in first example? not getting question well, want text box width 100% , fixed button this? demo <input type="submit" value="search" /> <div> <input type="text" /> </div> input[type=submit] { float: right; } input[type=text] { width: 100%; } div { overflow: hidden; padding-right: .5em; }

nsstring - Escape bad characters for iOS UILabel? -

i'm feeding nsstring data (forum posts queried website) uilabel part of first app. thing is, sometimes, depending on content of post, label goes entirely blank. i've tinkered enough discern there characters cause problem, can't quite pin down full set. is there collected list of character types watch out kind of thing? , better, there method escaping them, or automatically converting them more acceptable? thank helping out n00b! looks have whitespace or new line in string: try this: nsstring* labeltext = [stringfromwebsite stringbytrimmingcharactersinset:[nscharacterset whitespaceandnewlinecharacterset]]

html - confusion with jquery , ajax post -

i have simple html page , , using jquery/ajax , trying send simple json file php server.the behavior of script though confusing.. first of tried , have found on web(other questions) : script1 var data = {"deviceuuid":"lssfds998", "os":"bb", "pushtoken":"l1355436gdfsfdsl"}; $.ajax({ type: "post", url: "http://192.138.4.115/server_cityinfo/register.php", data: data, contenttype: "application/json; charset=utf-8", datatype: "json" }).success(function(response, status, xhr){ console.log(response); console.log(status); console.log(xhr); }); script1 , sends empty (null) json file server. script2 var data = {"de...

CORS request to IP not domain name -

how can make cors xmlhttprequest directly ip address, not domain. for example, load web page example1.org. i try make cors request http://example2.org/ , thats working. cors request http://192.168.1.100 not working. why? the target of example.org dns entry 192.168.1.100. fiddler2 http sniffer says, browser not making request, check cors http header sent server. i've tried google chrome version 29.0.1510.0 canary , version 26.0.1410.64 m. example code cors request (that code working. i'm not on page in example.org origin.): var req = new xmlhttprequest(); req.withcredentials = false; req.open('get', 'http://example2.org:8088/getmydata', true); req.onreadystatechange = function() { console.log(req.responsetext); }; req.send(); if attempt @ connection considered local ip address browsers may have (or may start have) restrictions. another thing might causing problems if page on https , ip address not. however, without more informati...

java - display a non-selectable default value for JComboBox -

i have jcombobox contains 3 items {"personel", "magasinier", "fournisseur"} . i want jcombobox display value "choisir une option :" , non-selectable value. i tried code after initcomponents(); : this.jcombobox1.setselecteditem("choisir une option :"); but doesn't work. how can ? you override selection code in jcombobox model, code such following sscce: public class jcomboexample { private static jframe frame = new jframe(); private static final string not_selectable_option = " - select option - "; private static final string normal_option = "normal option"; public static void main(string[] args) throws exception { jcombobox<string> combobox = new jcombobox<string>(); combobox.setmodel(new defaultcomboboxmodel<string>() { private static final long serialversionuid = 1l; boolean selectionallowed = true; @override public void ...

C# false if statement being used -

solved: code excecuted via events every 10 ms, increasing time takes between events solved issue. i´m experiencing odd indexoutofrangeexception shouldn´t happening. code inside if statement being used though statement ´false´. known problem? if so, how can fix this? the error occurs when counter (an int ) 0, requesting element -1 array lights. code: if (counter > 0) { console.writeline("counter-1 groter dan 0"); int = counter - 1; lights[i].setstate(0); } unless counter accessed/manipulated in multi-threaded way - should impossible state. you can try making assignment & check in 1 place: var index = 0; if ((index = (counter - 1)) > 0) { lights[index].setstate(0); }

facebook-android-sdk: Force reauthentication using the sdk 3.0.1 -

is there way trigger reauthentication dialog using facebook-android-sdk 3.0.1? possible using javascript sdk (see https://developers.facebook.com/docs/facebook-login/reauthentication/ ), haven't found android sdk. the dialog should triggered when user wants enter "edit profile" section of app. i used this session session = session.getactivesession(); if (session != null){ session.closeandcleartokeninformation(); session = null; log.i(tag, "cleared session"); session.openactivesession(activity, true, sessioncallback); }

vba - Excel Looping through cells with vbTextCompare to assign categories -

i have spreadsheet contains summary column(column k) on each row. need match words in summary column in order assign category name in new column(column v). i tried doing normal excel if statement have sinc efound out there limit. i'm trying use following vba code. public function getcategory() v_end_of_table = activesheet.usedrange.rows.count 'count number of rows used' dim cell range each cell in range("k2:k" & v_end_of_table) 'loop through each row until end of table' if instr(1, cell.value, "nationalities", vbtextcompare) > 0 range("v" & v_end_of_table).value = "nationalities" else range("v" & v_end_of_table).value = "no match found" end if next 'move onto next cell' end function so i'm trying loop through each row, match text , assign value. stands @ moment #value! returned. if change range("v" & v_end_of_table).value to msgbox ...

r - Find values in a given interval without a vector scan -

with r package data.table possible find values in given interval without full vector scan of data. example >dt<-data.table(x=c(1,1,2,3,5,8,13,21,34,55,89)) >my.data.table.function(dt,min=3,max=10) x 1: 3 2: 5 3: 8 where dt can big table. bonus question: possible same thing set of non-overlapping intervals such as >i<-data.table(i=c(1,2),min=c(3,20),max=c(10,40)) >i min max 1: 1 3 10 2: 2 20 40 > my.data.table.function2(dt,i) x 1: 1 3 2: 1 5 3: 1 8 4: 2 21 5: 2 34 where both i , dt can big. lot first of all, vecseq isn't exported visible function data.table , syntax and/or behavior here change without warning in future updates package. also, untested besides simple identical check @ end. that out of way, need bigger example exhibit difference vector scan approach: require(data.table) n <- 1e5l f <- 10l ni <- n / f set.seed(54321) dt <- data.table(x = 1:n + sample(-f:f, n, replace = true)) <-...

c# - How to merge multiple datatables (every datatable return one row) in one row -

i have multiple data tables : want merge them (my p.k : emp_num ) var tblemp_data = new datatable();//one row var tblemp_time = new datatable();//one row var tbl_emp_mission = new datatable();//one row tblemp_data = getempinfo(empnum); tblemp_time = getemptime(empnum, start_period, end_period); tbl_emp_mission = getempmission(empnum, start_period, end_period); tblemp_data.merge(tblemp_time, false, missingschemaaction.add); tblemp_data.acceptchanges(); tblemp_data.merge(tbl_emp_mission, false, missingschemaaction.add); tblemp_data.acceptchanges(); now data on multiple rows rather 1 row ! want data on 1 row ? how ? note: want columns allow null except primary key avoid exception : failed enable constraints. 1 or more rows contain values violating non-null, unique, or foreign-key constraints edited: the third table cause problem: public static datatable getempmission(int empnum, datetime start_period, datetime end_period) { using (ifxconnecti...

asp.net mvc - jquery.wysiwyg work with mvc2 -

i'm using jquery.wysiwyg ( https://github.com/akzhan/jwysiwyg ) mvc2. how can value of textarea? <%@ page title="" language="c#" masterpagefile="~/views/shared/site.master" inherits="system.web.mvc.viewpage<notificationsviewmodel>" %> <script> $(document).ready(function(){ $('#message').wysiwyg(); }); </script> <% using (html.beginform("managenotifications", "admin", formmethod.post)) { %> <table class="noborderverticalcenter" style="width:100%;"> <tr> <td>message</td> <td> <%= html.textareafor(model => model.message) %> </td> </tr> </table> <% } %> hope helpful var textcontent=$("#textarea-id").wysiwyg('getcontent'); this give u text including html tags to strip html tag use ethis textcontent=textcontent.re...

lotus domino - Anyone having experience with DominoTomcatSSO project? -

is there having experience dominotomcatsso project? (see here http://www.openntf.org/internal/home.nsf/project.xsp?action=opendocument&name=dominotomcatsso ) i'm running tomcat 6.0.37 , domino 9 server. have configured , can't see error on domino console. when try login in tomcat application , mistype password, domino , tomcat correctly report, username/password incorrect things working fine. when type correct password, i'm getting error in tomcat application below. when browser cookies, ltpatoken there somehow cannot used when creating notes session in error message. hint can wrong here? notesexception - 4616 cookie invalid notesexception: cookie invalid @ lotus.domino.notesexceptionhelper.read(unknown source) @ lotus.domino.notesexceptionholder._read(unknown source) @ lotus.priv.corba.iiop.repimpl.invoke(unknown source) @ lotus.priv.corba.portable.objectimpl._invoke(unknown source) @ lotus.domino.corba._iobjectserverstu...

php - How to add align (left, center, right) to table inside a loop -

how add align table loop? i have code: <table width="960px" border="0" cellspacing="0" cellpadding="0"> <tr valign=top> <? activate ('main/inside'); $rid = ('main/inside'); $l = openfileslist (page, 'id', asc, 20); $i = 0; while ($id = readlist ($l)) { setactive ($id); if (!$rid) $rid = _say ('Раздел'); $q = 0; $arr = array('left', 'center', 'right'); if ($i == 0) echo '<td align='.$arr[$q++].'>'; ?> "some text" <? if ($i++ == 1) { echo '</td>'; $i = 0; } } if ($i>0) { echo str_repeat ('', 2-$i); echo ''; } ?> </tr> </table> the output should ... <td align="left">some text text</td> <td align="center">some text text</td> <td align="right">some text text</td>... but code...

java - Custom hamcrest matcher that works with "not"? -

i have class (say, entity ). i want able test instance of "valid", using custom code decide that also test instance not valid, ideally using same code. using maven, surefire, junit 4.11 (and hamcrest stuff shipped it). so write class this class isvalidentity extends typesafematcher<entity>{ @override public boolean matchessafely(entity e){ // , here bunch of asserts... assertnotnull(e.id); // etc. } @override public void describeto(description description) { description.appendtext("is valid entity"); } @factory public static <t> matcher<entity> validentity() { return new isvalidentity(); } } ok, fine, can do assertthat(entity, is(validentity()); in junit test, peachy. but can't do assertthat(entity, not(validentity()); because validentity fails broken asserts, while not guess should return false . clearly i'm doing backwards here i'm...

debian - What's the "Invalid syntax" in this LDAP automount command/file? -

i want use ldap automount user's home , nfs. followed this tutorial configure ldap , automount. (automount information: fstype=nfs,hard,intr,nodev,nosuid,rw 192.168.0.1:/home/serveur/dupont) dn: cn=dupont, ou=nfs, ou=services, dc=projet, dc=sys objectclass: top objectclass: automount cn: dupont i have syntax error when trying add file. $ ldapadd -x -f au.ldif -w -d cn=admin,dc=projet,dc=sys ldap_add: invalid syntax (21) additional info: objectclass: value #1 invalid per syntax i can't seem find source of error. $ ldapsearch -x # extended ldif # # ldapv3 # base <dc=projet,dc=sys> (default) scope subtree # filter: (objectclass=*) # requesting: # # projet.sys dn: dc=projet,dc=sys objectclass: top objectclass: dcobject objectclass: organization o: nsalab dc: projet # admin, projet.sys dn: cn=admin,dc=projet,dc=sys objectclass: simplesecurityobject objectclass: organizationalrole cn: admin description: ldap administrator # people, projet.sys dn: ou=pe...

How to set up basic WCF service - client application? -

i new wcf , try create first wcf service - client application. use visual studio 2010. i create wcf service application i try add service reference project. after pressing "discover", service occured. after clicking on or expanding, error occurs. tried fix config files, error messages changing. what minimum configuration keep basic wcf service working? server side configuration <services> <service name="program01.testclass" behaviorconfiguration="testbehavior"> <endpoint address="" binding="basichttpbinding" contract="contracts.icontract"/> <host> <baseaddresses> <add baseaddress="http://localhost:9817/testservice"/> </baseaddresses> </host> </service> </services> <behaviors> <servicebehaviors> <behavior name="testbehavior"> <servicedebug includeexc...

opencv - SURF and OpenSURF to color image -

i using surf features in opencv input images converted gray image. cvtcolor(object, object, cv_rgb2gray); when went through documentation of opensurf realised not in grayscale. my confusion can apply surf image formats (yuv, hsv, rgb) or have change , modify program achieve that? most feature detectors work on greyscale because analyse patterns of edges in image patch. can run surf on single colour channel colour formats mention i.e. can run on y, u or v yuv images, or on h, s or v hsv images. not sure how opensurf treats this, must using greyscale image internally.

php - ebay api (EPN) Query to pull classified items and auction items (auction items with 1 bid minimum) -

this may localized. using epn (ebay) api, trying pull auction items minimum bid of 1 , classified items. this have item filters: &itemfilter(0).name=minprice&itemfilter(0).value=10 &itemfilter(1).name=maxprice&itemfilter(1).value=10000000000000000 &itemfilter(2).name=listingtype&itemfilter(2).value(0)=auction &itemfilter(2).value(1)=classified &itemfilter(3).name=minbids&itemfilter(3).value=1 from can work out, appears when add: &itemfilter(3).name=minbids&itemfilter(3).value=1 it overrides command list items in classified. shows auction items minimum bid of 1. can achieve want @ all?

sql server - Sql - Fetch next value to replace variable value -

hi guys basic sql knowledge needs i want able replace variable value value in table , keep running query until end value in table reached start query declare @prime_schema varchar(20) declare @next_schema varchar(20) declare @table_name varchar(100) declare @sql varchar(500) set @prime_schema = 'aaa' set @next_schema = 'bbb' set @table = 'table1' set @sql = 'select top 1 * '+@next_schema +'.'+@table_name +' '+@prime_schema +'.'+@table_name +' truncate table '+@next_schema +'.'+@table_name print @sql i want wrap in fetch , use table called 'table_val' update table_name value , loop around till rows have been used in table so end multiple @sql statements thanks try 1 - query: declare @prime_schema sysname = 'aaa' , @next_schema sysname = 'bbb' declare @sql nvarchar(max) select @sql = ( select char(13) + ' select * [' + @...

jquery ui - Sorting with item and Drag and drop for delete -

i want gp_item should sortable , when drag , drop under gp_delete area gp_item should deleted. when did, either working sorting or deleting. both not working together. <div id='container_gp'> <div id='1' class='gp_item'> graph 1</div> <div id='2' class='gp_item'> graph 2</div> <div id='3' class='gp_item'> graph 3</div> </div> <div id='gp_delete'>drop delete here </div> i have written that. $('.gp_item').draggable({ revert: true, proxy:'clone' }); $("#gp_delete").droppable({ activeclass: "active", drop: function(event, ui) { if(confirm("are sure wish delete")) { //delete code ui.draggable.remove(); } } }); i modified bit code , w...

ios - Two Image Views Get added to the scrollView which I add using objects library? -

in application using scrollview show list of data(by adding each view each entry in list), when new entry added data list add new view subview scrollview,i use subviews count position newly added view , there came across issue scrollview has 2 imageviews. i checked in -viewdidload - (void)viewdidload { [super viewdidload]; nslog(@"subvs %@",[samplescroll subviews]); } here console window subvs ( "<uiimageview: 0x72b9610; frame = (233 121; 7 7); alpha = 0; opaque = no; autoresize = tm; userinteractionenabled = no; animations = { contentscenter=<cabasicanimation: 0x72dd8b0>; position=<cabasicanimation: 0x72e2520>; }; layer = <calayer: 0x72b96b0>>", "<uiimageview: 0x72e2ae0; frame = (233 121; 7 7); alpha = 0; opaque = no; autoresize = lm; userinteractionenabled = no; animations = { contentscenter=<cabasicanimation: 0x72b7c50>; position=<cabasicanimation: 0x72b7ce0>; }; layer = <calayer: 0x72e2b...

python - Loop list and open file if found -

not sure start this... know how read in csv file if have heap of files in same directory, how can read them in according whether in list. example, list such as... l= [['file1.csv','title1','1'], ['file2.csv','title2','1'],['file3.csv','title3','1']] how can 3 files though 'file20.csv' in directory. can somehow loop through list , use if-statement check filenames , open file if found? for filedesc in l: #go on each sublist in l fname, ftitle, _ = filedesc #unpack information contained in open(fname) f: #open file appropriate name reader = csv.reader(f) #create reader of file #go bussiness

html - Resizeable div with background image -

i have div background image: <div id="mydiv"> ... </div> #mydiv { background-image: url(...); width: 70%; max-width: 200px; } now, want background image resized fit div. this, added background-size: 100%. solves problem regarding width, height accomodates content of the, , since content of div smaller, image cropped in bottom. should set height attribute follows resizing of width? if understand well, want background streched , fit exactely div. in case, try set both values of background-size property in way: background-size: 100% 100%;

selenium - Executing tests Concurrently on different OS and Browsers with WebDriver using Java and TestNG -

i have configured grid in system , written test script. can run test on specified os , browser on 1 os , 1 browser @ 1 time not os , browser simultaneously. here have done. please tell me how can configure can run in configured os in 1 time. my script using java below: import java.net.malformedurlexception; import java.net.url; import org.junit.afterclass; import org.openqa.selenium.*; import org.openqa.selenium.remote.desiredcapabilities; import org.openqa.selenium.remote.remotewebdriver; import org.testng.annotations.*; public class gridwithwebdriver { public webdriver driver; @parameters({"browser"}) @beforeclass public void setup(string browser) throws malformedurlexception { desiredcapabilities capability=null; if(browser.equalsignorecase("firefox")){ system.out.println("firefox"); capability= desiredcapabilities.firefox(); capability.setbrowsername("firefox"); ...