Posts

Showing posts from June, 2011

c# - How to use Linq to find dates in listed but not in another -

i have 2 list objects: 1 describes list of shifts , describes list of sick leave. what trying compare 2 lists , return result gives list of sick leave, dates in sick-leave not in list of shifts. i have written code, not return list: var nonavailabledates =availability .where(a=>! shiftday.any(b=>b.shiftdate.date == a.startperiod.date)).tolist(); can please show me have gone wrong? thanks you're looking set difference operation, except() method in linq (will give elements in first collection not in second): list<datetime> shifts = new list<datetime>{ datetime.parse("1/1/2014"), datetime.parse("1/2/2014")}; list<datetime> sickleaves = new list<datetime>{datetime.parse("1/1/2014"), datetime.parse("1/3/2014")}; var sickleavesthatarenotalsoshifts = sickleaves.except(shifts); // contains 1/3/2014 edit: give shot. we're joining , taking items don't have match. var sickleavesnotin

vba - Excel: How to use a checkbox form marco to hide column on MAC -

i'm using activex checkbox following macro in worksheet: private sub checkbox1_click() if checkbox1 = true columns("p:v").hidden = true else columns("p:v").hidden = false end if end sub and works fine on pc. when try on mac, doesn't work since mac doesn't have activex support. tried using regular form control checkbox, doesn't appear function @ when use macro. have ideas? i'm kind of vba/excel noob. if put 2 forms checkboxes on sheet , name them "cbb" , "cbc" can assign macro below both of them. column affected depend on checkbox triggers sub. code regular module: if want in sheet module replace activesheet me sub checkbox_click() dim vis boolean, ac string, col string ac = application.caller activesheet vis = (.shapes(ac).controlformat.value = 1) select case ac case "cbb": col = "b" case "cbc": col = "c

Php - Is it possible to block access to a webpage depending on the address used? -

consider following scenario. there site on local network can accessed 1 of 2 ways: 11.11.11.111/testsite (ip) test.site.com (vhost) is possible php allow access using test.site.com? edit: while there many suggestions how solve problem, went publi design & john v.'s mod_rewrite suggestion, implemented in httpd.conf file , redirected forbidden page. what worked me was: rewriteengine on rewritecond %{http_host} !^test.site.com$ [nc] rewriterule .? - [f] i avoid php request , go 1 level. haven't tried this, maybe .htaccess file you, using similar this: rewriteengine on rewritecond %{http_host} !^11.11.11.111/testsite$ [nc] rewriterule ^(.*)$ test.site.com/$1 [l,r=301] you might have play around it, imagine along lines should want be.

c# - Customizations vs Residue collectors -

i don't grasp difference between customizations , residue collectors. according documentation , if register customization can build, exampleclass handle requests type were not handled other builders . if register residue collector type exampleclass handle requests, were not handled (other) builders where's difference? tl;dr that's valid question. difference between 2 priority , order in they're given chance handle requests. customizations first, while residue collectors last. autofixture, @ core, consists of chain of responsibility each node in pipeline called specimen builder . these builders organized in 3 categories, determine position in chain: customizations engine residue collectors specimen builders higher in chain handle incoming requests first, effectively overriding further down . customizations typically ad-hoc specimen builders created user handle kind of requests in particular way. hence, they're given highest priority.

sql server 2008 - C++ ADO.NET Cannot insert the value NULL into column -

i'm trying insert lines in database, got error while executing code : #using <mscorlib.dll> #using <system.dll> #using <system.data.dll> #using <system.xml.dll> #include <sstream> #include <time.h> #include <string> #include <iostream> #include <tchar.h> using namespace system; using namespace system::data; using namespace system::xml; using namespace system::data::sqlclient; // entry point application int _tmain(void) { sqlconnection ^ mysqlconnection; sqldataadapter ^ mydataadapter; dataset ^ mydataset; datarow ^ myrow; sqlparameter ^ myparameter; try { mysqlconnection = gcnew sqlconnection("data source=nectarys-pc;initial catalog=monitoringn;integrated security=true;"); mydataadapter = gcnew sqldataadapter(); mydataset = gcnew dataset(); // open connection mysqlconnection->open(); mydataada

python - Why am I not getting the correct response? -

i complete python noob foreshadowing done, trying parse information out of soap response. body of reponse below: <soap:body> <processmessageresponse xmlns="http://www.starstandards.org/webservices/2005/10/transport"> <payload> <content id="content0"> <customerlookupresponse xmlns=""> <customer> <companynumber>zq1</companynumber> <customernumber>1051012</customernumber> <typecode>i</typecode> <lastname>name</lastname> <firstname>basic</firstname> <middlename/> <salutation/> <gender/> <language/> <address1/> <address2/> <address3/> <city/>

javascript - adding a new section on webpage using only css and js -

i trying click on image on webpage , open new section on page created in css , javascript/jquery. thought using .addclass() not entirely sure how go it. can give me example of being done? an example clicking on element id foo , adding div id bar after element: $("#foo").click(function(){ $(this).after('<div id="bar">some content</div>'); }); of course, there multiple methods in jquery insert content somewhere in dom tree, see: https://api.jquery.com/category/manipulation/dom-insertion-outside/ https://api.jquery.com/category/manipulation/dom-insertion-inside/

What are the finest-grained operations on the .git/index file? -

certain git commands, such git add ... modify state of .git/index file, imagine such operations may thought sequence of smaller operations. example, git add foo bar may decomposable into git add foo git add bar in fact, there may (for know) commands above may broken down "finer-grained" (but still " .git/index -modifying") git commands. my question is, finest-grained modifications can performed on .git/index file using git commands? iow, "atomic" command-line operations on .git/index ? i imagine these commands plumbing commands. also, if had guess, i'd imagine gid add <file> , git rm --cached <file> approximate 2 of operations. on other hand, git mv <old> <new> may composite of "atomic" deletion followed "atomic" addition... edit: motivation question following. the aspects of git 's behavior find confusing result in modification of .git/index file. else git bit more ope

reactjs - Pass props from template into react.js root node -

i may have missed something, here goes. if have: var swoosh = react.createclass({ render: function() { return ( <div classname="swoosh"> boom. </div> ); } }); react.rendercomponent( <swoosh />, document.getelementbyid('content') ); can set props attributes on mount point (where id='content' )? <div id='content' foo='alice' bar='has' bav='a cat' /> <!-- have foo, bar & bav available props in <swoosh />? --> no, though of course can do: var container = document.getelementbyid('content'); react.rendercomponent( <swoosh foo={container.getattribute('foo')} bar={container.getattribute('bar')} bav={container.getattribute('bav')} />, container ); (or if want make attributes dict using https://stackoverflow.com/a/5282801/49485 , can swoosh(attributes) ).

c++ - modbus tcp clent server with multiple slave id -

i'm working on win ce 6 modbus tcp client server, application developed client server communication , working fine. req slave device should respond diff slave addresses polled master/client. can change slave id , establish connection or need close previous connection , again establish new one below code, working fine 1 node, if polled other node id gives exception. change req communicate other node simultaneously. device should able communicate 32 diff nodes on modbus tcp. shall create individual threads each node how communicate on same port? before establishing connection other node shall close previous node? startupserver(int slaveaddr, const tchar * const hostname) { int result; int tcpoption; struct sockaddr_in hostaddress; if (isstarted()) return (ftalk_illegal_state_error); // note: tcp allow 0 slave address, -1 means ignore slave adr if ((slaveaddr < -1) || (slaveaddr > 255)) return (ftalk_illegal_argument_error); this->

multithreading - Ruby doesn't execute the code of all threads -

i'm learning how use threads in ruby i've found strange problem. that's code: require 'active_record' require 'rss' require 'open-uri' require 'thread' require_relative 'model/post' require_relative 'model/source' queue = queue.new producer = [] activerecord::base.establish_connection( adapter: "postgresql", host: "localhost", database: "trendy", username: "postgres", password: "postgres" ) sources = source.all puts "active record has loaded: #{sources.length} feeds" sources.each |source| producer << thread.new puts "feed: #{source.url}" end end producer.join puts "number of threads created #{producer.length}" and that's output: active record has loaded: 5 feeds feed: http://alt1040.com/feed feed: http://appleweblog.com/feednumber of threads created 5 process finished exit code 0 if run again,

getting a null pointing exception in eclipse java -

when try call addgrade method in student class, uses addgrade in grades class nullpointerexception . says have add more details i'm not sure why. class 1 is public class grades { private double qualpts; private int numcreds; public grades() { } /** * returns gpa */ public double getgpa() { if (numcreds>0) return qualpts/numcreds; return 0; } /** * adds new grade's credits * weights newly added grade */ public void addgrade(int creds, double grade) { numcreds+=creds; qualpts+=creds*grade; } /** * returns number of credits */ public int getnumcred() { return numcreds; } } class 2 is public class student { private string name; private string bnumber; private grades grades; public student(string name, string bnumber) { this.name=name; this.bnumber=bnumber; } /** * adds new grade's credits * weights new grade */ public void addgrade(int creds, double grade) { grades.addgrade(creds,grade); } } in construc

javascript - PHP retrieve new images from database -

apologies noob question i’m still learning. firstly i’m not asking program following problem me or give me code. i’m merely looking bit of logic , bit of advice. what trying do this example, trying different use same logic: trying display movie poster on website, user can rate movie between 0 - 5 stars, his/her rating recorded in database , along other users’ ratings. when he/she has finished his/her rating, new movie poster needs displayed he/she can again rate poster , goes on until he/she tired of rating movies. the logic i assuming need use php here store , retrieve data a table created contains different images , ratings corresponding movie’s rating, along number of users rated movie calculate average total rating the problem how image change once user rated image? is possible change image src onclick php javascript? if how do it? possible need use combination of php , javascript here? any or advice appreciated. thank in advance. you need use b

How do you query installed nuget packages with the command line interface? -

i need find installed version of package inside ci build script using nuget command line. the "list" command returns packages nuget.org feed far can tell. want locally installed packages. i know how vs nuget powershell console. please not answer "use get-package". need nuget.exe. however if there's way use nuget command plain powershell outside of visual studio acceptable. nuget list -source http://my.local.feed/ list packages available in local feed, , dir .\packages within top-level solution folder show packages installed under location (where .\packages install location have set solution). from http://docs.nuget.org/docs/reference/command-line-reference#list_command_options , how specify directory nuget packages installed?

sql - Left outer join difference in various databases -

i in understanding difference in way various databases interpret left outer join. in scenario there 1:1 relationship between left , right table, imagine count of join operation equal count in left table. i have observed true ms sql oracle (pl/sql) seems having different interpretation of this. count of left outer join in oracle sum of entries in left table + matching entries in right. kindly confirm if correct in understanding , best methodif have reconcile data between oracle , ms sql. the code - select distinct nvl(l11, nvl(l10, nvl(l9, nvl(l8, nvl(l7, nvl(l6, nvl(l5, nvl(l4, nvl(l3, nvl(l2, nvl(l1, nvl(l0,'err')))))))))))) enditem, case when l1 = 'raw wafer' l0 when l2 = 'abc' l1 when l3 = 'abc' l2 when l4 = 'abc' l3 when l5 = 'abc' l4 when l6 = 'abc' l5 when l7 = 'abc' l6 when l8 = 'abc' l7 when l9 = 'abc' l8 when l10 = 'abc' l9 when l11 = 'abc' l10 end item

r - Error in read.fwf when header=TRUE -

i have simulated data looks this: lastname date email creditcardnum agezip amount paul 21/02/14 aliquam.fringilla@dolordapibus.co.uk 4241033422900360 6738851$14.39 bullock 2/7/2014adipiscing.fringilla@lectusjusto.org 5178789953524240 3336538$498.31 mcmahon 11/5/2013lobortis.ultrices@lacus.org 5389589582467450 7734302$92.44 walters 25/09/13 consectetuer.cursus.et@sitamet.org 5157094536097720 7794007$206.60 franco 17/06/13 et@disparturientmontes.ca 345477952996264 2415873$89.12 and how i'm attempting import r, headers: w <- c(11,10,57,16,3,5,8) df <- read.fwf("data.txt",widths=w,stringsasfactors=f) names(df) <- df[1,]; df <- df[-1,] the reason i'm not using header=t gives me error: error in read.table(file = file, header = header, sep = s

ruby - Convert instance of class org.jruby.RubyArray to class java.util.ArrayList -

i'm new ruby & jruby . want test stuffs of jruby in java code here code : import java.util.arraylist; import java.util.hashmap; import org.jruby.embed.localvariablebehavior; import org.jruby.embed.scriptingcontainer; public class test { public static void main(string[] args){ scriptingcontainer container = new scriptingcontainer(localvariablebehavior.persistent); test t = new test(); logstatbean bean = t.new logstatbean(); container.sethomedirectory("classpath:/meta-inf/jruby.home"); container.put("bean", bean); container.runscriptlet("arr = [1, 2, 3, 4, 5, 6]"); container.runscriptlet("puts arr"); container.runscriptlet("bean.setoutput(arr) "); system.out.println(bean.getoutput()); } public class logstatbean { public arraylist<hashmap<string, object>> getoutput() { return output; } public

Android ListView that scrolls from bottom to top? -

i'd build listview works normal listview, except first item on bottom , grows up, instead of first item being on top , growing down. of course, can use normal listview, reverse order of adapter, , have scroll last item on list... inelegant in number of ways, particularly when adding new rows. for instance, listview remember position, position bottom instead of top. so, if @ bottom, should remain @ bottom, if looking 3 bottom, should still looking @ item when new item added. (exactly how works in listview normally, reversed.) wondering if has clever tricks reverse polarity of android listview? the classic use case list of chat messages, recent 1 on bottom, , items added bottom. if @ end of list, still want @ end of list when new message comes in. if have scrolled away bottom, don't want scroll position randomly reset. ah, abslistview has attribute: android:stackfrombottom="true" which seems wanted.

maven - Use the latest snapshot of dependency? -

update: simplifying question - have module mod1 used dependency in module mod2. make sure mod2 utilizes latest version snapshot of mod1. how can achieve in maven? ================ i have 2 modules 1 module used dependency in module. how can make sure latest snapshot of mod1 gets utilized in mod2? both modules mentioned in parent pom following - <modules> <module>mod1</module> <module>mod2</module> </modules> i have release version of mod1 on remote maven repo (version 1.0). now, in build when there code chanage in mod1, gets built 1.1-snapshot (not deployed on remote repo). how can make sure mod2 utilizes (latest) snapshot version? if mod1 source changed new version 1.1-snapshot needs utilized in mod2 , if mod1 did not have source change existing latest version of 1.1 need utilized in mod2. suggest how use latest snapshot/release here? tried following in pom.xml mod2 - <dependency> <groupid>com.test</groupid>

regex - Javascript regexp search with capture -

how capture 2 integers following string 2 different variables using regexp javascript search? "10 of 25" your regex statement going specific strings, answer might specific whatever actual use-case is. put decimals in capturing groups. .+? in front of mean "match lazily until find 2 decimals". --so if there change you'll have 2 decimals shouldn't captured you'd want add checks such positive lookahead/lookbehind quotes, etc. .+?(\d\d).+?(\d\d).+? simply refer each capture group $1, $2, etc. use ?: in group make non-capturing, fwiw. http://regex101.com/r/vn6jo2

c++ - Looped signal handling for UNIX -

i have loop in main() continue until stop signal (ctrl z) or quit (ctrl ) obtained. loop: signal(sigquit, signalhandler); signal(sigtstp, signalhandler); while (1) sleep(1); what want when receive ctrl z signal, in addition printing out "stop received", want program stopped. current signal handler function: void signalhandler(int signum) { if (signum == sigquit) cout << "quit recieved" << endl; break; else if (signum == sigtstp) cout << "stop recieved" << endl; break; else { cout << "something's wrong" << endl; exit(-1); } } what need add in order me (this being stop signal received , stop program)? i've tried far putting raise(sigtstp) in signalhandler function, puts me in infinite loop. i've tried creating volatile sig_atomic_t , initializing 0, never updates me once signal received (it stays @ 0).

Url to invoke the java web service -

i have web service below. body please tell me url invoke getuserdetails(); ....://localhost:8080/jersey-rest/rest/hellow / want url after hellow/.... @path("/hellow") public class helloworldservice { @get @path("/{name1}/{name2}/") public response getuserdetails(@pathparam("name1") string name1,@pathparam("name2") string name2){ string output = "user info .. "+name1+name2 ; return response.status(200).entity(output).build(); } thank you ....://localhost:8080/jersey-rest/rest/hellow/joe/bob/ example

ios - Best way present and hide UIView on top of UIWindow from NSObject? -

i've nsobject class handle locations , in specific point shows uiview , updates view , hides , vice versa. i tried few methods addsubview : [uiapplication sharedapplication].keywindow [uiapplication sharedapplication].windows.firstobject i've uilabel on top of uiview updates value (distance point point), somehow doesn't updates view anymore, shows once , thats , doesn't hides back. my code: // updates uiview nsobject class: nsmutabledictionary *params = [[nsmutabledictionary alloc] init]; params[@"distance"] = @(distancetotrap); params[@"traptype"] = @(trap.gettraptype); params[@"trapid"] = @(trap.gettrapid); trapalarmactivity = [[trapalarm alloc] initwithuserinfo:params]; [trapalarmactivity setneedsdisplay]; [trapalarmactivity.screenview setneedsdisplay]; [[uiapplication sharedapplication].keywindow addsubview:trapalarmactivity];

javascript - Three.js move object to point along some line & lookAt -

Image
i have cuboid (three.cubegeometry 1x1x10 example). here's i'm trying accomplish: given point, want place cuboid distance away origin, along line formed origin , said point rotate cuboid faces origin i'm tried using obj.lookat(new three.vector3(0, 0, 0)); but rotates object in such way side faces origin, instead of end. as first step (finding point along line n units away origin), don't know start. did normalize vec point, [i think] gets me, essentially, line of length 1, (0, 0, 0) pointing towards point. move point want (n distance origin), can scale vector accordingly. not sure if makes sense... edit in answer 1 of comments saying how obj.lookat() should work, here's i'm getting, , i'd have instead: how cuboid being drawn after position set point, lookat() invoked note side of object looking @ origin (not want) what i'd have object @ point end (i guess i'm 1 rotation away that, that's 1 rotation i'm not sure h

javascript - Error - Don't make functions within a loop -

i trying replace placeholders in email template, following code:- i getting error : don't make functions within loop var dataplaceholders = [{ "username":"john johny", "website":"w3schools . com" }]; template_html = "<b>hello <%= username %>,</b><br/><br/> successfuly registered on xyz.<br/><br/>thank <%= website %>"; function call :- function replaceplaceholders(dataplaceholders, template_html){ (var = 0; < dataplaceholders.length; i++) { var obj = dataplaceholders[i]; template_html += "" + template_html.replace("/<%=%>/g", function (match, property) { return obj[property]; }) + ""; } return template_html; } thanks help. from jslint error explanations : the fundamental problem here javascript interpreter create instance of function pe

javascript - Jquery validation of string and date -

i want validate 3 input field http://jsfiddle.net/hskat/20/ only add date is there regular expression validating this.. dont want use plugins $('.validate-string').change(function (e) { var valid_str = $(this).val(); ........ }); here 1 method validate string , number.. date have define format want, kindly check below code number , string $(document).ready(function () { $('.validate-string').change(function (e) { var valid_str = $(this).val(); var regex = /^[a-za-z ]*$/;         if (regex.test(valid_str)) {             alert("valid");         } else {             alert("invalid");         } }); $('.validate-number').change(function (e) { var valid_num = $(this).val(); if(!valid_num.match(/^[0-9,\+-]+$/)){ alert("only numbers allow"); return false; } });

javascript - styling using jquery based on condition -

i have following html code, have given background color red #list . if number of li more 5, want change background blue. please assist <html> <head> <script src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ var len= $("#list li").size(); if(len>5){ // need code style #list here if number of li more 5, background blue } }); </script> </head> <body> <ul id="list" style="background:red; width:300px;height:300px;"> <li>image 1</li> <li>image 2</li> <li>image 3</li> <li>image 4</li> <li>image 5</li> <li>image 6</li> <li>image 7</li> <li>image 8</li> <li>image 9</li> <li>image 10</li> </ul> </body> </html> you'll want use .length in

css3 - How can I gracefully degrade CSS viewport units? -

css viewport units ( vw , vh , vmin , vmax ) great, , want start using them fonts -- noticed here aren't supported. tried google best practices graceful degradation in unsupported browsers, couldn't find useful. there better ways beyond doing like: h1 { font-size: 120%; /* unsupported browsers */ font-size: 5.3vmin; /* supported browsers */ } thanks in advance! native usage you'll @ least want provide fallback: h1 { font-size: 36px; /* tweener fallback doesn't awful */ font-size: 5.4vw; } also tells mimicing functionality fittext.js. for more information, read chris coyier's "viewport sized typography" http://css-tricks.com/viewport-sized-typography/

python - PyQt: Console-like interface as a QTextEdit subclass -

i'm novice attempting write z-machine interpreter -- specialized virtual machine text adventures zork -- in python, using pyqt4. decided subclass qtextedit program's main interface, i'm having trouble turning widget i'm looking for. have able append text it, accept user input on same line last appended character, append more text, , user must never allowed edit of text appended program or entered user. put way, have periodically make text in widget read except new text user typing @ end of it. here's code i've tried recently: class zscreen(qtextedit): def __init__(self, parent=none): super(qtextedit, self).__init__(parent) self.setundoredoenabled(false) self.setacceptrichtext(false) self.readonlybefore = self.textcursor().position def changeevent(self, e): if self.textcursor().position < self.readonlybefore: self.setreadonly(true) else: self.setreadonly(false) supe

r - Convert normalized variables back to non-normalized values -

i built kmeans cluster first normalized several of variables in r. model provides me cluster centers, in normalized state (like center of income -1.6). i want convert -1.6 non-normalized value able give practical meaning (like income 42,000). now can individually convert z-score value, there way several normalized variables r function? i can start pnorm() percentage- looking more can apply original dataframe before normalized it. it might easiest calculate means of (raw) data once have cluster assignments. example, using plyr: # install.packages('plyr') require(plyr) dat <- mtcars[,1:4] dat$cvar <- kmeans(scale(dat), 3)$cluster ddply(dat, c("cvar"), colwise(mean)) cvar mpg cyl disp hp 1 1 13.41429 8.000000 390.5714 248.42857 2 2 23.97222 4.777778 135.5389 98.05556 3 3 16.78571 8.000000 315.6286 170.00000

sql - Update date in mysql database -

i have mysql database client appointments table, want update appointments once year 364 days. gives me same tuesday @ 5:30pm 1 year later. not need update same date, same day 364 days ... except leap year. please help why not use mysql date_add function full documentation here select date_add(curdate(), interval 1 year) you can same in update statement set date columns set mydate = date_add(mydate, interval 1 year)

Using IqualProp in C# -

i want develop tool assess quality of video. did r&d on , found interface called "iqualprop", part of directshow api. not trying sample code in c# on how use interface, not finding anywhere. there samples in c++ use "iqualprop", not in c#. on great. iqualprop iqp = your_obj iqualprop; after doing can access properties of interface.

asp.net mvc - using model value in MVC codescope -

Image
i trying model value in mvc codescope- @model funranger.models.cardmodel @{ viewbag.title = "carddetails"; layout = "~/views/shared/_layout.cshtml"; var link = string.format( "'http://www.facebook.com/sharer.php?u='+'http://funranger.com/home/carddetails/?cardid'+'@model.cardid", url.encode("http://funranger.com/home/carddetails/?cardid=@model.cardid/"), url.encode("this site") ); } here can see trying model value in var link , sharing on facebook. here in codescope want @model.cardid 's value. how model value? for example url like- http://funranger.com/home/carddetails/?cardid=178 edit- string encodedurl = string.format("http://funranger.com/home/carddetails/?cardid={0}", model.cardid); string link = string.format("http://www.facebook.com/sharer.php?u={0}", url.encode(encodedurl)); it shared on website encodeurl path. facebook sharing shows

oracle - Unable to import csv file into SQL developer -

i have db table's 'csv file'. truncated db table. while importing csv file using sql developer , data aren't getting inserted. amd following procedure given in tool. step step procedure following: right-click on table name , click import csv. choose csv back-up file choose header column in data preview screen , click next. move available columns selected columns' side in choose columns screen , click next. source , target data columns matching fine in column definition screen. click next. click verify in finish screen. success on columns. in last step, clicking on finish , loading tables there no data restored table. can please me?

cordova - How to Centre Align Popup in Javascript PhoneGap App -

when call popup popup second popup doesn't show in middle of page. example in code below if click on "bookmark" next popup opens in top left region of page looks bit odd. <button onclick="$('#bookmarkspopup').popup('open');">popup</button> <div data-role="popup" id="bookmarkspopup"> <ol data-theme="d" data-role=listview data-inset=false > <li><a data-icon="home" data-rel="popup" href="#bmpopup">bookmark</a></li> <li><a data-icon="home" onclick="closepopup();">close</a></li> </ol> </div><!-- /popup bookmarkpopup--> <div data-role="popup" id="bmpopup"> <ol data-theme="d" data-role=listview data-inset=false >

google maps - How to get user destination by code in c# -

my project is: asp.net mvc4 idea next: have 3 google engines parse google response. engines google.com, google.ru, google.co.uk. have method user destination , display google engine based on destination, forexample if user russia make search google.ru, if user uk im work google.co.uk , others i'm use google.co.uk. may check programmatically? you can use service find location of user using ip address. http://freegeoip.net/ . can use api http://freegeoip.net/json/115.113.234.46 . it returns json response follows. { "ip": "115.113.234.46", "country_code": "in", "country_name": "india", "region_code": "", "region_name": "", "city": "", "zipcode": "", "latitude": 20, "longitude": 77, "metro_code": "", "areacode": "" } then pa

deserializing json C# "First chance exception of type - newtonsoft" -

i trying save , load files isolatedstorage based on this class forum member shawn kendrot got throughout this forum post . i’m able save no problem when loading deserialising json file getting error “a first chance exception of type 'newtonsoft.json.jsonserializationexception' occurred in newtonsoft.json.dll” i don’t know doing wrong, because file saved , it’s reading not deserializing. json file has 4 entries @ moment, have 6 later on. can me understand wrong here? it's function: public static t readshareddata<t>(string filename) t : class, new() { t result = new t(); var mutex = getmutex(filename); mutex.waitone(); filename = getsharedfilename(filename); try { var storage = isolatedstoragefile.getuserstoreforapplication(); if (storage.fileexists(filename)) { using (var filestream = storage.openfile(filename, filemode.open, fileaccess.read))

set - Alternative to using TreeSet in java? -

i'm looking set class use given comparator removeall(). i using treeset after few hours ripping hair out trying figured out why removeall() not removing found this... http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4730113 long story short removeall() uses equals() method. (but oddly enough remove() method doesn't...) i want set duplicates removed, preferably comparator not required, , can't override equals method b/c need other logic. , avoid making loop calls remove() on elements doesn't confuse me in future (or else). does such animal animal exist? treeset.removeall method accepts collection<?> parameter. objects in collection can of type, not comparable objects. need make own set different method. note bug resolution "won't fix"

iphone - Wait until GameCenter score download id complete -

i download score gamecenter, don't know how wait, when score downloaded. when run code, returns null. think, method have wait when [leaderboardrequest loadscoreswithcompletionhandler: ... have score downloaded. - (nsstring*) getscore: (nsstring*) leaderboardid { __block nsstring *score = nil; gkleaderboard *leaderboardrequest = [[gkleaderboard alloc] init]; if (leaderboardrequest != nil) { leaderboardrequest.identifier = leaderboardid; [leaderboardrequest loadscoreswithcompletionhandler: ^(nsarray *scores, nserror *error) { if (error != nil) { nslog(@"%@", [error localizeddescription]); } if (scores != nil) { int64_t scoreint = leaderboardrequest.localplayerscore.value; score = [nsstring stringwithformat:@"%lld", scoreint]; } }]; } return score; } the code completion handler calle

php - How to get value of dynamically generated table using javascript -

here trying value inside <td> value </td> using javascript getelementbyid(id); not able fetch value , display value in alert box. code: <script type="text/javascript"> function getvalue() { var lat = document.getelementbyid('lat').value; var lon = document.getelementbyid('lon').value; var lati = parseint(lat); var long = parseint(lon); alert(lati,long); } </script> php-html code: while($row = mysql_fetch_assoc($retval)) { echo "<tr>"; echo "<td>" . $row['id'] . "</td>"; echo "<td>" . $row['theater_name'] . "</td>"; echo "<td>" . $row['address'] . "</td>"; echo "<td id='lat'>" . $row['lat'] . "</td>"; echo "<td id='lon'>" . $row['lon'] . "</td>"; echo "</tr>"; } the table auto g

opencv - Merging with background while thresholding -

Image
i doing project on license plate recognition system. facing problem in segmenting license plate characters. have tried cvadaptivethreshold() different window sizes, otsu , niblacks algorithm. but in of cases license plate characters merge background. sample images , outputs given below, in first image license plate characters connected white line in bottom hence using thresholding algorithm couldn't extract characters, how can extract characters images... ?? in second image noise in background merges foreground, connects characters together.. how can segment characters in these types of images..?? is there segmentation algorithms can segment characters in second image.. ? preprocessing: find big black areas on image , mark background. example treshold. way might use findcontours (contourarea size on result). way know areas can colour black after step 1. use otsu (top image, right column, blue title background). colour know background black. us

sql - Rails, squeel - loop inside 'where' -

i want use sort of loop or iterator inside statement like product.where{ array.each |e| (id >= e[0]) & (id <= e[1]) end } is possible? in reality query more complicated, , don't want post whole architecture here. product.where('id >= ? , id <= ?',array[0],array[1])

css - Changing the background colour of an :after - JQuery -

i'm trying change colour of :after, using jquery although can't seem able change it, can point me in right direction please? <script> $( document ).ready(function() { $( ".breadcrumb li:nth-child(1) a" ).css({'background-color' : '#f00'}); // works $( ".breadcrumb li:nth-child(1):after " ).css({'background-color' : '#f00'}); // not work? }); </script> i've tried using few selectors cannot find correct one. in advance. try this, css .li-active-after a{background-color : #f00; } .li-active-after:after{background-color : #f00; } jquery $( document ).ready(function() { $(".breadcrumb li").removeclass('li-active-after'); $(".breadcrumb li:nth-child(1)").addclass('li-active-after'); });

php - Delay in autoplay of vimeo's video -

i using iframe display video on www.ridesharebuddy.com. using autoplay feature in this. i doing way. <iframe src="//player.vimeo.com/video/82633004?title=0&amp;byline=0&amp;portrait=0&amp;autoplay=1" width="500" height="320" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> but starts before whole page loaded. can give delay in load video after 5-10 seconds? you can append video link after page loaded via jquery. <iframe id="vimeo_frame" src="#" width="500" height="320" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> <script> jquery(window).load(function() { var vimeo_frame = jquery('#vimeo_frame'), vimeo_src = 'player.vimeo.com/video/82633004?title=0&amp;byline=0&amp;portrait=0&amp;autoplay=1'; settimeout(function() {

apache - Need .htaccess rewrite by referrer -

i have images every item stored in seperate folders, this. http://domain.com/upload/phones/2262/1.jpg now want redirect user using .htaccess if referrer google http://domain.com/az/phones/item/2262/ can anyony me in this? put code in document_root/.htaccess file: rewriteengine on rewritecond %{http_referer} google [nc] rewriterule ^upload/([^/]+)/([0-9]+)/[^.]+\.jpe?g$ /az/$1/item/$2/ [l,nc,r] just keep in mind http_referer header can manipulated.

javascript - minicart.js not working, cart is not popping up -

i using minicart.js simple paypal shopping cart. not working should. cart not popping if click 'add cart' button. here's code. <html> <body> <script src="//cdnjs.cloudflare.com/ajax/libs/minicart/3.0.3/minicart.min.js"></script> <script> paypal.minicart.render(); </script> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_cart" /> <input type="hidden" name="add" value="1" /> <input type="hidden" name="business" value="labs-feedback-minicart@paypal.com" /> <input type="hidden" name="item_name" value="test product" /> <input type="hidden" name="quantity&quo

hibernate 4 compatibility with spring -

is hibernate 4.0 compatible spring 3.0 looked many blogs says 3.1 , above version of spring required use hibernate 4.0 version. please clarify same. hibernate 4.x support available since spring 3.1 see documentation . given announcement, assume hibernate 4.x support not available in spring 3.0.