Posts

Showing posts from February, 2010

c# - Block closing WPF window (from a different thread) if OpenFileDialog is open -

to clear things before mention obvious choice, calling showdialog , not show method!!! i block close (invoked different thread) off wpf window if openfiledialog open. here code have (reduced show problem): public class foowindow : window { public foowindow() { initializecomponent(); this.closing += onclosing; } public void opendialogandcloseme() { var ofd = new openfiledialog(); thread th = new thread(() => closeme()); th.start(); ofd.showdialog(this); } public void closeme() { system.threading.thread.sleep(2000); //give openfiledialog time pop up... //since method gets called different thread invoke it... this.dispatcher.invoke(() => this.close()); } private void onclosing(object sender, canceleventargs e) { //check if openfiledialog still open , block close... e.cancel = true; } } the problem facing onclosing part, how ope...

sql - retrieve Number of days between order date and shipment date -

order table has order date , shipment date. need retrieve number of days between order date , shipment date. example: order date = 31/08/96 shipment date= 10/09/96 oracle 11g. just subtract them, e.g. in select date2 - date2 total_days dual

haneke - Carthage errors "No tagged versions found for github" -

i want use carthage in projects, installed carthage. prepared cartfile in project's root folder. when typed carthage update command in terminal, got error: *** cloning hanekeswift no tagged versions found github "haneke/hanekeswift" the cartfile file contains these lines: github "alamofire/alamofire" >= 1.2 github "haneke/hanekeswift" why getting error? if project has no tags, need give branch or ref. github "haneke/hanekeswift" "master" for instance.

java - UnsupportedClassVersionError on running play application with JDK 1.7 -

just started learning play framework project requirement , project build on jdk 1.7 have downloaded play 2.3.9 version , created sample project typing activator new . moved sample project directory , executed activator run . see jdk incompatible exceptions. have make changes handle this? log: [info] loading project definition e:\workspace\play\first-app\project [info] set current project first-app (in build file:/e:/workspace/play/first-app/) java.lang.unsupportedclassversionerror: com/typesafe/config/configexception : unsupported major.minor version 52.0 @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(classloader.java:800) @ java.security.secureclassloader.defineclass(secureclassloader.java:142) @ java.net.urlclassloader.defineclass(urlclassloader.java:449) @ java.net.urlclassloader.access$100(urlclassloader.java:71) @ java.net.urlclassloader$1.run(urlclassloader.java:361) @ java....

javascript - On [for="description"]' click not working -

jsfiddle i trying if label has attribute for="description" on click should focus other element. i have tried following not working. possible click event on attribute. or other can possibilities achieve this? other adding class or id. $('[for="description"]').on('click', function() { console.log('test'); alert('test'); }); you have typo in click event keyword. should lowercase. code: $('[for="description"]').on('click', function () { alert('test'); }); otherwise, have not define element class name nicedit-main . demo

php - Mount operation in Silex - additional trailing slash -

i have small backend developed in silex framework. try make request work on post: http://localhost/feedback/other but when using mount operation request works: http://localhost/feedback/other/ as can see must add additional trailing slash request. here code doesn't work expected: //index.php $app->mount("/other", new feedbackother()); //feedbackother.php $feedbackother->get("/", "feedbackothercontroller::index")->bind('other'); $feedbackother->post("","feedbackothercontroller::store"); if //index.php $app->post('/other', "feedbackothercontroller::store"); $app->mount("/other", new feedbackother()); //feedbackother.php $feedbackother->get("/", "feedbackothercontroller::index")->bind('other'); the post request works without additional slash, in case don't see point in using mount operation. also i've trie...

java - NullPointerException Google Maps API Android 4.4.4 -

when access activity shows map on android 4.4.4 device, app crashes, , in logcat see this: 06-26 11:07:30.211 10977-10977/com.andrey.andreyvedis.iamaref e/androidruntime﹕ fatal exception: main process: com.andrey.andreyvedis.iamaref, pid: 10977 java.lang.runtimeexception: unable start activity componentinfo{com.andrey.andreyvedis.iamaref/com.andrey.andreyvedis.iamaref.poloactivity}: java.lang.nullpointerexception @ android.app.activitythread.performlaunchactivity(activitythread.java:2436) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2495) @ android.app.activitythread.access$900(activitythread.java:170) @ android.app.activitythread$h.handlemessage(activitythread.java:1304) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:146) @ android.app.activitythread.main(activitythread.java:5635) @ java.lang.reflect.method.invokenative(native method) ...

vb.net - CreateObject not working on user machine in VB6 for tlb file created in VS .Net 2010 -

i having issue , appreciate if can make work. writing dll in .net use in vb6 project. matter every developer should able use dll in vb6 projects adding dll reference. after researching created tlb file .net using intercom option. below code tlb file, <comclass(comclass1.classid, comclass1.interfaceid, comclass1.eventsid)> public class comclass1 #region "com guids" ' these guids provide com identity class ' , com interfaces. if change them, existing ' clients no longer able access class. public const classid string = "7b640688-3583-46bd-9a69-26f8632864e3" public const interfaceid string = "b3a59c91-fcd5-484e-83a9-24ec028e9b32" public const eventsid string = "1388246f-39c1-4b9b-bf6f-9dc3f1b75299" #end region ' creatable com class must have public sub new() ' no parameters, otherwise, class not ' registered in com registry , cannot created ' via createobje...

How to add a dropdown <option> in a rails form? -

i had created scaffold- rails g scaffold shipment name:string description:text from:string to:string date:string pay:string i want form:string drop down (with kolkata/delhi/mumbai options) , not text field. how can this? i had searched web upper level. new rails , trying learn this. you can use select helper in app\views\shipments\_form.html.erb file <%= form_for(@shipment) |f| %> <%= f.label :from %><br> <%= f.select :from, [ 'kolkata','delhi','mumbai' ], :prompt => 'select one' %> <%= f.submit %> <% end %>

Colormap and GIF images in Matlab -

i have problem understanding colormaps in matlab , using them import , diplay .gif images. i import image using im = imread('i.gif') , display using imshow(im) result wrong if [im,map] = imread('i.gif') , display using imshow(im,map) works properly, still don't understand need of colormap is there way import , convert gif image greyscale when imshow(im) shows correct greyscale image without having worry colormap? sorry noob question starting image processing in matlab , appreciate help. first question! :) bye , thanks! if want convert gif grayscale, use ind2gray : [im,map] = imread('i.gif'); imgray = ind2gray(im,map); the reason need colormap gif format doesn't store image intensities, stores indices colormap. color 0 red or green or light shade of mauve. it's colormap stores actual rgb colors image needs. ind2gray take each of colors, convert them grayscale intensity, , replace indices in image intensities.

r - Convert list into a data.frame -

this question has answer here: r list data frame 15 answers i have list names f .and have matrix dataasli . >f [[1]] [1] na 13481 13938 14846 15399 15534 15534 15892 16835 17726 16538 15399 [13] 15534 15150 15205 16011 16835 17726 19060 19331 19335 18900 [[2]] [1] na 13608 13913 14696 15467 15331 15646 15882 16826 17075 16388 15467 [13] 15331 15331 15191 16002 16863 18150 19030 19330 19336 18892 [[3]] [1] na 13545 13900 14771 15433 15433 15636 15877 16821 17036 16463 15433 [13] 15433 15148 15184 15998 16849 18225 19015 19330 19336 18888 [[4]] [1] na 13608 13893 14696 15467 15359 15629 15874 16819 17013 16388 15413 [13] 15522 15147 15180 15995 16863 18150 19006 19329 19337 18886 [[5]] [1] na 13566 13888 14746 15445 15422 15625 15872 16817 16997 16438 15445 [13] 15422 15147 15177 15993 16854 18200 19000 19329 19337 18884 ...

php - MSQL to MYSQLI converter -

this question has answer here: changing mysql mysqli? [closed] 2 answers i'm not familiar mysqli <?php $bestaat = mysql_query("select * badgesdownload limit 7"); while($bestaat2 = mysql_fetch_array($bestaat)) { $bestaat3 = $bestaat2['naam']; $txt = mysql_query("select * badgesdownload naam = '".$bestaat3."'"); while($txt2 = mysql_fetch_array($txt)){ $txt3 = $txt2['txt']; echo $bestaat3; echo'<br>'; echo $txt3; echo'<br>'; } } ?> how can change script mysqli? mysqli - procedural method similar. add database connection first parameter query, , 'i' in functions... $bestaat = mysqli_query($db, "select * badgesdownload limit 7"); while($b...

c++ - Opencv - Finding edges of different objects with same algorithm -

Image
i pretty new opencv , first project, need suggestions. trying find dimension of different objects. have written code based on tutorials on opencv.org , examples on learning opencv book bradski & kaehler. until working 1 object. when tried find dimension of different object, realized needed change threshold1 value of canny. so question is: how can make program kind of adjustments different objects automatically? won't need change manually. kind of algorithm should use? background same, camera's position fixed, can assume lighting same. for picture need threshold1 value of 53 in order find edges. for one, value of 141 works pretty good. i couldn't find values one, since color same background's. here code: #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #include <iostream> #include <stdio.h> #include <stdlib.h> using namespace cv; using namespace std; mat src, src_gray, src_blur; ...

javascript - Separate the arrows from the slider functionalities -

i have slider that's switching dividers, , above 2 arrows (prev , next) don't care way arrows or way positioned. want them functional, other functionalities applied slider such hover, being applied arrows too. how can keep buttons function (next/prev) make separate slider. jsfiddle: http://jsfiddle.net/1ju1k0f6/ css: #first { width: 50%; height: 220px; margin:auto; padding-left: 170px; margin-top: 2px; } #first img { height: 100px; width: 100px; float:left; margin-right: 5%; cursor: pointer; } #wrapper { width: 10%; padding: px 0; } #slider-container { padding: 20px 50px; height: 1350px; top:-18%; left: -45px; width: 700px; overflow: hidden; position: relative; } .slider-view-area { max-height: 300px; } #nav img { position: absolute; top: 40px; left: 0px; cursor:pointer; color:grey; } #prev { margin-left: 520px; font-size: 30px; } #next { rig...

php - Javascript Magento Create Account Preference Error -

i trying create second action on create new user account form on magento 1.9ce. need additional action build http string , send url configured. far have built script pick fields, javascript isn't processing because varienform attached event handler on document load. shed light on code have why not processing? <script type="text/javascript"> $(document).ready(function() { window.settimeout(function() { $('#form-validate').on('submit', function( e ) { var elements = this.elements; e.preventdefault(); e.stoppropagation(); var subscribed = elements.is_subscribed.checked ? "y" : ''; var bglink = "http://suite9.emarsys.net/u/register_bg.php?owner_id=428212131&f=1481&key_id=3&optin=" + subscribed + "&inp_1=" + elements.firstname.value + "&inp_2=" + elements.lastname.value + "&inp_3=" + elem...

css - Hide urls when printing a page -

Image
i have webpage: it looks when try print it: it's missing last item (user management) intentionally that's not problem. i'd hide "(/campaigns)" , "(/profanity)" print. is possible using css? --edit-- html: <div class="row"> <div class="item col-xs-12 col-sm-6 col-md-4 text-center"> <div class="lead">campaigns</div> <a href="/campaigns" class="text-muted"> <i class="fa fa-bullhorn"></i> </a> <table class="table table-striped table-condensed"> <tbody><tr> <th>campaigns active</th> <td>1/1</td> </tr> <tr> <th>total posts</th> <td>149</td> </tr> </tbody></table> <...

django - Display initial form.FileField as img tag in template -

my form class: class myform(forms.form): image = forms.imagefield() in view (get case) instance form (then pass template ctx): form = myform(initial={'image':my_model_obj.image}) now in template wanto display image as: <img src="{{form.image.url}}"> but doesn't work, src stay blank. as workaround did in view: form = myform() form.image_display = my_model_obj.image and in template: <img src="{{form.image_display.url}}"> is way it? (i know can pass image context variable meh..) thank in advance i've not tested :d found in docs from django.core.files.uploadedfile import simpleuploadedfile file_data = {'image': simpleuploadedfile(my_model_obj.image.name.split('/')[-1], my_model_obj.image.file)} form = myform(file_data) https://docs.djangoproject.com/en/dev/ref/forms/api/#binding-uploaded-files-to-a-form

parsing - time.Parse with custom layout -

i'm trying parse string pattern "4-jan-12 9:30:14" time.time . tried time.parse("2-jan-06 15:04:05", inputstring) , many others cannot working. i've read http://golang.org/pkg/time/#parse , https://gobyexample.com/time-formatting-parsing seems there aren't examples this. thanks! edit: full code: type customtime time.time func (t *customtime) unmarshaljson(b []byte) error { auxtime, err := time.parse("2-jan-06 15:04:05", string(b)) *t = customtime(auxtime) return err } parsing time ""10-jan-12 11:20:41"" "2-jan-06 15:04:05": cannot parse ""24-jan-15 10:27:44"" "2" don't know did wrong (should post code), simple function call: s := "4-jan-12 9:30:14" t, err := time.parse("2-jan-06 15:04:05", s) fmt.println(t, err) outputs: 2012-01-04 09:30:14 +0000 utc <nil> try on go playground . note time.parse() r...

javascript - Jquery inArray method not working in multidimensional array -

i'm trying create function stop creation of duplicate sub arrays in array using jquery's inarray function doesnt seem work. maybe missing in code? function createproduct() { var name = document.getelementbyid("productname").value var myclass = document.getelementbyid("productclass").value var model = document.getelementbyid("model").value var manufacturer = document.getelementbyid("manufacturer").value var sellingprice = document.getelementbyid("productsellprice").value var costprice = document.getelementbyid("productcostprice").value var quantity = document.getelementbyid("quantity").value productobject = [name, manufacturer, model, myclass, sellingprice, costprice, quantity]; var searchvalue = productobject; *if (jquery.inarray(productobject, products) == -1) { products.push(productobject) } else if (jquery.inarray(productobject, products) != -1) { docu...

Google Drive: Rest API access to another users shared folder in a google drive account -

i developing web-app where-in users able create content in own google drive account , share others. allow app access folder shared (say, publically) user through drive rest api , present content other users of app. (to clarify, not want list or show files through google drive website read contents programmatically , process within app). would such scenario possible google drive , if how should proceed setting up? thanks in advance ps: looked @ service account seems every user have register same app if want share contents of drive others through app. have got correct? you asked long time ago... in case answer else opened page looking same solution. let's you list files in way: def google_files client = google::apiclient.new client.authorization.access_token = token.last.fresh_token drive_api = client.discovered_api('drive', 'v2') @result = array.new page_token = nil begin parameters = {:orderby => 'folder'} if p...

scala - Exceptions Thrown by Await#result -

given following code: import spray.http._ import spray.client.pipelining._ import scala.concurrent.future implicit val system = actorsystem() import system.dispatcher // execution context futures val pipeline: httprequest => future[httpresponse] = sendreceive val response: future[httpresponse] = pipeline(get("http://spray.io/")) the following pseudo-code function waits 10 seconds, returning "good" if httpresponse returned, or "bad" on await#result exception (see docs . import scala.concurrent.await import scala.concurrent.duration._ def f(fut: future[httpresponse]): string = { try { val result = await.result(fut, 10.seconds) "good" } catch e @ (_: interruptedexception | _: illegalargumentexception | _: timeoutexception ) => "bad" } in catch , necessary catch exception thrown await#result ? in other words, not catching possible exceptions here? the await.result can throw exceptions...

jquery - Load Textarea text into input boxes -

Image
for website, users can provide list of tracks. far works, wish feature textarea textbox function so people copy paste textfile textarea, convert button reads text , places proper artist/track in inputbox so if user puts in: artist1 - track1 artist2 - track2 artist3 - track3 artist4 - track4 the jquery code should place these input boxes artist , track separated. how can achieve this? thanks in advance! this job. no need convert button. listen input event: $('textarea').on('input', function() { var sp= this.value.split(/[\r\n]/); sp.foreach(function(value, i) { var sp= value.split(/ *- */); $('.artists tr').eq(i).find('input').eq(0).val(sp[0]); $('.artists tr').eq(i).find('input').eq(1).val(sp[1]); }); }); textarea { width: 90%; height: 6em; } .artists td:nth-child(1):before { content: 'artist'; display: block; font: 9px verdana; color: brown; } ...

How do I get this AngularJS service working in my code? -

here code service. taken first answer here. var myapp = angular.module('myapp', ['ngroute']); myapp.service('sharedproperties',function(){ var property = "first"; return{ getproperty:function(){ return property; }, setproperty:function(value){ property = value; } }; }); here jsfiddle shows code in full , not working. the error is: "error: sharedproperties not defined for line alert on. using alert mere example of showing service working before extend code further. anyone know why simple example of service not working? i've thoroughly went on code make sure there no typos or silly that. the answer linked has jsfiddle uses older version of angularjs. able replace version angular being used in jsfiddle , still worked fine doesn't seem version issue. you need inject s...

sql - Calculating a running count of Weeks -

i looking calculate running count of weeks have occurred since starting point. biggest problem here calendar working on not traditional gregorian calendar. the easiest dimension reference 'tweek' tells week of year record falls into. example data: create table #foobar ( datekey int ,tweek int ,cumweek int ); insert #foobar (datekey, tweek, cumweek) values(20150630, 1,1), (20150701,1,1), (20150702,1,1), (20150703,1,1), (20150704,1,1), (20150705,1,1), (20150706,1,1), (20150707,2,2), (20150708,2,2), (20150709,2,2), (20150710,2,2), (20150711,2,2), (20150712,2,2), (20150713,2,2), (20150714,1,3), (20150715,1,3), (20150716,1,3), (20150717,1,3), (20150718,1,3), (20150719,1,3), (20150720,1,3), (20150721,2,4), (20150722,2,4), (20150723,2,4), (20150724,2,4), (20150725,2,4), (20150726,2,4), (20150727,2,4) for sake of ease, did not go way 52, point. trying recr...

javascript - fadeTo not working in ie10 -

i not sure why after looking @ examples thought same previous questions decided post.. have button when clicked following things... $('.fa-phone, .bg-darkpink').parent().on('click', function () { $('#testimonials').fadeto(0, 0); $('.submenu-ctn').fadeto(0, 0); $("#colorscreen").remove(); $("body").append('<div id="colorscreen" class="animated"></div>'); $("#colorscreen").addclass("fadeinupbigcs"); $(".musability-music-therapy-content-space").css({width: "720px",opacity:1}).load("contact-page.html #contact-form"); $(".submenu-ctn").load("contact-page.html .submenu-contact"); $.getscript("js/slider/slider-animations.js"); $(".submenu-ctn").load("contact-page.html .submenu-contact"); $('.nav-toggle').removeclass('active...

django - TDD with Python chapter 1 no output from functional_tests.py -

i following book tdd python. in chapter 1 there piece of code from selenium import webdriver import unittest class newvisitortest(unittest.testcase): def setup(self): self.browser = webdriver.firefox() self.browser.implicitly_wait(5) def teardown(self): self.browser.quit() def test_can_start_a_list_and_retrieve_it_later(self): self.browser.get('http://localhost:8000') self.assertin('to-do', self.browser.title) self.fail('finish test!') if __name__ == '__main__': unittest.main(warnings='ignore') the file called functional_tests.py. have django 1.7 , selenium installed globally on ubuntu 14.04. started fresh project superlists. run server before try tests. when run test with python3 functional_tests.py firefox window opens , loads default django startup page , window stays open though should close after test runs. there no output tests @ all. expecting this: f...

Why does a .NET 4.0 program produce a system.unauthorizedAccess error on a Windows Server 2012 machine with .NET 4.5 installed? -

Image
i'm getting error seems occur on machines running windows server 2012 . application written .net 4.0 environment. hypothesis in .net 4.5 isn't playing nicely application. have no other ideas. the application designed create pdf files. calling multiple instances of itself. main application call exe file set of parameters indicate pdf files create. in way can call multiple exe files, speeding process. testing purposes, can disable calls outside programs changing setting create pdf files same program, more slowly. the pdf files saved onto local hard drive. user should have access local drives , administrator privileges. there no hidden folders. as main application goes call new instance of itself, crash. see picture below. either can't use exe file, or can't write local drive. i'm not sure which; if need create log will, can determine if application can't call exe file or if application can't write local drive. however, if run same application adm...

c++ - copy constructor for a class with pointer to a user defined type -

i have seen many examples of copy constructor classes member variables pointer int or char. can advise on right way of writing copy constructor class member ptrb pointer user defined class b please. is correct: class { private: b *ptrb; public: a() { ptrb = new b; } a(const a& other); ~a(); } a::a(const a& other) { ptrb = new b; *(ptrb) = *(other.ptrb); } and if ptrb defined this: shared_ptr<b> ptrb; then this? a::a(const a& other) { ptrb(new b); *(ptrb) = *(other.ptrb); } thanks. since tagged post "deep-copy" assume want copy constructor that. default copy constructor generated using shared_ptr not deep copy. i suggest there 2 general forms copying pointer-like member. deep(const deep& other): ptr(new t(*other.ptr)) {} and shallow(const shallow& other) = default; note, shallow copy won't work unique_ptr. design, unique_ptr prevents that. here example of each, showin...

css - Can't align p inside div with margin 0 auto -

i don't know going on can't align <p> inside div margin:0 auto; can't understand wrong or i'm missing, code: <div class="test"> <p>text has centered</p> </div> this css .test { width: 100%; margin: 0 auto; max-width: 600px; text-align:center; background-color: #ececec; } .test p { display:inline-block; } with this, text moved little bit on center of div it's not centered .test p { text-align: center; } that's need. if centering block element need margin:auto

pentaho - An error occurred while rendering Pivot.jsp while try to view the published cube -

i using pentaho community versions "biserver-ce-5.2.0.0-209" bi server viewing published cube , "psw-ce-3.9.0.0-213" schema workbench creation of sample cube published successfully but when trying jpivot_view cube published getting below error an error occurred while rendering pivot.jsp. please see log details can me on this

google app engine - PHP-GDS store string that is longer than 1500 bytes -

the php-gds library awesome - can't stress enough. however there datastore limitation ->addstring must contain string less 1500 bytes. there alternative store strings greater 1500 bytes? e.g. datastore documentation refers textproperty type. would possible add ->addtext() method? thanks! if @ datastore docs here: https://cloud.google.com/datastore/docs/concepts/entities#datastore_properties_and_value_types if differentiates between 1500 or 1mb strings based on whether indexed or not. if want store more 1500 bytes should able - make sure field defined in schema not indexed. if run problems, can raise issue here: https://github.com/tomwalder/php-gds/issues p.s. link posted python-specific docs, can misleading there subtle differences. tom (php-gds author - kind words!:)

c++ - Interactive two-way communication (using pipes) between child and parent processes -

i trying create child process, redirect stdin , stdout parent process, , interact child process. is, parent process should able receive input child, process it, , provide output child, , cycle repeats (like user interaction shell, end goal: simulate user interaction). thus far have been able create , redirect pipes (the code below echoes input on parent process, user, through child). problem can once, child terminates after first i/o cycle, , sigpipe. how can keep child alive, , have read pipe when parent writes it? p.s. know except can used simulate user interaction, need access returned data custom analysis, , i'd go way academic purposes. #include <iostream> #include <string> #include <sstream> #include <unistd.h> #include <stdio.h> #include <sys/wait.h> #include <limits.h> #include <sys/types.h> #include <cstdlib> #define max_cmd_size 256 #define max_buff_size 512 #define num_pipes 2 #define parent_read_pipe pip...

twitter bootstrap - Email invoice (MVC web page) from asp.net -

i have mvc website process transactions, , renders page transaction information invoice. and have option print page receipt. the invoice nicely styled bootstrap , more custom styles, i asked make option email invoice email on transaction now question is, if there way render page on server pdf, , email without returning page client, also if possible, need make pdf print css styles applied, because there lot of stuff hidden on page @ print. i use rotativa convert razor view pdf , keeps css styles , layouts. it works me. https://github.com/webgio/rotativa the nuget link below. looks lot people using it. https://www.nuget.org/packages/rotativa

javascript - How to use Soundcloud API (authentication) with Angular.js -

i can use public soundcloud api, struggling callback.html login dialog. at soundcloud app has following callback redirect uri callback.html: http://localhost:8080/#/callback on route angular app defines controller desired callback template: <!doctype html> <html lang="en"> <head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>connect soundcloud</title> </head> <body onload="window.opener.settimeout(window.opener.sc.connectcallback, 1)"> <b style="width: 100%; text-align: center;">this popup should automatically close in few seconds</b> </body> </html> in root controller defined: sc.initialize({ client_id: "####", redirect_uri: "http://localhost:8080/#/callback", }); thats why public api works me @ controller: sc.get('/resolve', { url: 'https://so...

cookies - Uncaught Error: Syntax error, unrecognized expression: jquery -

in site, using value stored in cookie displayed once site opened, whenever site opened iam replacing window.location url stored in cookie. shows uncaught error, when refresh site error gone , redirects url in cookie. code: var url=$.cookie("lasturl");//getting url cookie window.location.replace(url);//replacing window.location this error iam getting: `uncaught error: syntax error, unrecognized expression: #page2?aid=322952&artistid=322952&id=334945` this cookie set: var lasturl= window.location.hash; $.cookie("lasturl", lasturl); what have done wrong in this???? var url = $.cookie("lasturl"); //getting url cookie window.location.replace(url); //replacing window.location the replace method of location requires url, giving hash.

javascript - Prevent Script from loading normally -

i creating chrome extension webpage. page has script execute changes way page displayed removing or emptying elements. found <script> tag need delete or stop executing. there way load page memory, parse remove <script> tag , load normally? the way can remove code via javascript of yet use chrome inspector disable javascript , run following code. var scripts = document.getelementsbytagname('script'); (i=0, max=scripts.length; < max; i++){ var currents = scripts[i]; var xinner = currents.innerhtml; if (xinner.indexof('jsmenu1') < 1){ currents.parentnode.removechild(currents); } } strange request. work. $(document).ready(function() { var $html = $('html'); var $script = $html.find('script#scripttoremove'); $script.remove(); var htmlstr = $html.html(); $html.html(htmlstr); });

javascript - Get description from the second drop down menu -

i have form 2 select menus ! first 1 "cat" loaded automatically database. second 1 "soucat" loaded automatically using javascript when item selected first select menu. the problem can't description second select menu send via $_post ! <form method="post" action="" oninput=""> <label> <select name="cat" id="cat" onchange="getcat()"> <option value="-1">categories</option> <?php /* fill in drop down menu database */ ?> </select> </label> <label id="souscat"> <select id="soucat" name="soucat"> <option value='-1'>subcategories</option> </select> </label> <span class="fieldd" id="searchformm"> <input type="text" name="searchterm" id="searchterm...

c# - Stop EF from trying to create initial DB -

so got solution create , initialize identity database. problem is, working on keep getting error cannot create file 'c:\webs\somescheduler\somescheduler\app_data\someschedulerusers.mdf' because exists. change file path or file name, , retry operation. create database failed. file names listed not created. check related errors. description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.data.sqlclient.sqlexception: cannot create file 'c:\webs\somescheduler\somescheduler\app_data\someschedulerusers.mdf' because exists. change file path or file name, , retry operation. create database failed. file names listed not created. check related errors. i know exists, want. how stop trying re-create every time try run code develop site? as always, , appreciated. add following line context constructor database.setinitializer<yourcontex...

java - what types of image processing i need to make image clear for OpenCV? -

Image
i'm working on android application capture image , detect page number using ocr, made processing using opencv on image , i'am stuck @ point 1 ![see image] so next step new image contains numbers ocr?? since numbers in same position, easiest way select them select portion of image, this: mat1b gray = imread("pat_to_image", imread_grayscale); rect roi(285, 630, 130, 100); // manually selected values mat1b numbers = gray(roi).clone(); numbers this:

javascript - Mongoose find all referenced documents -

does mongoose provide way find referenced documents previous query' result? for example: product .find(query) .exec(function(err, results) { ... product .find({ '$or': [ // products _id in results.associatedproducts[] ] }) ... }); i wasn't able find way natively mongoose, see below working solution. product .find(query) .exec(function(err, products) { ... var associatedsoftware = products.reduce(function(memo, current) { if(current.features && current.features.associatedsoftware) { return memo.concat(current.features.associatedsoftware.map(function(item) { return item._id; })); } return memo; }, []); product.find({ '$or': [ ... { '_id': { '$in': associatedsoftware } } ... ] }) .exec(function(err, associated) { ... }); });

java - Repository Pattern - How to understand it and how does it work with "complex" entities? -

i'm having hard time understanding repository pattern. there lot of opinions on topic in repository pattern done right other stuff repository new singleton or again in don't use dao use repository or take spring jpa data + hibernate + mysql + maven somehow repository appears same dao object. i'm getting tired of reading stuff since imho can't such hard thing displayed in lot of articles. i see this: appears want this: ------------------------------------------------------------------------ | server | ------------------------------------------------------------------------ | | | | client <-|-> service layer <-|-> repository layer <-|-> orm / database layer | | | | | -------------------------...

xslt - Add an attribute to output XML using something similar to call-template -

i've been searching few weeks now, , i've given up. have xslt script output xml file based on xsd definition. problem lies bit of code: sample input, types can arbitrarily nested: <xs:element name="rootelement"> <xs:complextype> <xs:sequence> <xs:element ref="r1" minoccurs="0" /> <xs:element ref="r2" minoccurs="0" /> <xs:element ref="r3" minoccurs="0"> <xs:complextype> <xs:sequence> <xs:element ref="r4" minoccurs="0" /> <xs:element ref="r5" minoccurs="0" /> </xs:sequence> </xs:complextype> </xs:element> </xs:sequence> </xs:complextype> </xs:element> xsl: <!-- wish work --> <xsl:if test="$minoccurs"> ...