Posts

Showing posts from January, 2010

c# - Show XML node value in MVC view by number of similar node? -

is there anyway group xml node value similar number? had tried output value below can't out want. please guide me on this. thanks! my answer_data sample in database: (after extract c1 , c2) question_id | answer_data ============================================== 1 | <answer_data><answer>c1</answer> 2 | <answer_data><answer>c2</answer> 3 | <answer_data><answer>c2</answer> string[] data after extract using linq: ["c1","c2","c2"] able view in mvc: c1 c2 c2 what want is: c1 - 1 c2 - 2 my controller: public actionresult surv_answer_result(int survey_id, string language = "eng") { list<answerquestionviewmodel> viewmodel = new list<answerquestionviewmodel>(); var query = r in db.surv_question_ext_model join s in db.surv_question_model ...

objective c - Getting word from string in iOS -

i getting string separately in loop -> inbox , [gmail]/all mail or [gmail acc]/trash i want find here substring like -> inbox , mail or trash , add array(folderarray). by seeing above words, there strings -> [gmail]/,[gmail acc]/ etc. coming unnecessarily , want remove them if such strings appear , words -> inbox, mail, trash i tried below code doesn't give me word expected following link sample string separator could me solve please? for (mcoimapfolder *fdr in folders) { nsstring *foldertitle = fdr.path; // gives inbox, [gmail]/all mail or [gmail acc]/trash (int i=0; i<[folderlist.defaultfolderarray count];i++) { if ([foldertitle rangeofstring:[folderlist.defaultfolderarray objectatindex:i] options:nscaseinsensitivesearch].location != nsnotfound) { nslog(@"yes contain word"); nsrange range = [foldertitle rangeofstring:[folderlist.defaultfolderarray objectatindex:i] options:nscaseinsensitivesearch]...

ios - Override init method to have singleton instance -

one third party library uses class initialisation: classa *a = [[myclass alloc] init]]; i need myclass shared instance (aka singleton) can't modify 3rd party way of executing myclass initialization i trying override init method following: - (instancetype)init { return [[self class] sharedinstance]; } + (loopmenativeevent *)sharedinstance { static loopmenativeevent *_sharedinstance = nil; static dispatch_once_t oncetoken; dispatch_once(&oncetoken, ^{ _sharedinstance = [loopmenativeevent new]; }); return _sharedinstance; } but, unfortunately new causes alloc init executed. simplest way know have 2 separate classes: myclass initialised through alloc init separate mysharedclass singleton is there possibility achieve having 1 class? how inheritance, create new class named childclass inherit myclass , add following 2 methods + (instancetype)sharedinstance { static childclass *sharedinstance = nil; sta...

java - How to make a local JBOSS AS 7 serve static resources? -

as standard, static resources need stay in centralized location, out of ears / wars (so can updated without rolling out new release minor js/css changes). my html imports relative, eg: <script type="text/javascript" src="/resources/myapp/js/bootstrap.min.js"></script> this means urls resources different on every server (development, test, production..): on dev-foobar.com : dev-foobar.com /resources/myapp/js/bootstrap.min.js on tst-foobar.com : tst-foobar.com /resources/myapp/js/bootstrap.min.js on foobar.com : foobar.com /resources/myapp/js/bootstrap.min.js but when i'm on local jboss ( localhost:8080 ), how can instruct serve same static resources achieve following url ? localhost:8080 /resources/myapp/js/bootstrap.min.js jboss handles static resources through folder called welcome-content under $jboss_home : c:\program files\eap-6.2.0\jboss-eap-6.2\ welcome-content simply put there, ,...

java - reverse SetLayeredWindowAttributes -

i using code sharing screen. have air desktop application(transparent backgound) have created. don't want window shared i.e should not visible client. using setlayeredwindowattributes hide window capture desktop , send image clients , unhide window. i using setlayeredwindowattributes make window transparent. how reverse i.e make window visible again. here code private int gwl_exstyle = -20; private int ws_ex_layered = 0x00080000; private int lwa_alpha = 0x00000002; private int lwa_colorkey = 0x00000001; int winlong = user32extra.instance.getwindowlong(hwnd, gwl_exstyle); user32extra.instance.setwindowlong(hwnd, gwl_exstyle, winlong | ws_ex_layered); user32extra.instance.setwindowpos(hwnd, null, 100, 100, 100, 100,(0x0002) | (0x0001) | (0x0004) | (0x0020)); user32extra.instance.setlayeredwindowattributes(hwnd, null, 128,lwa_alpha); /* code*/ user32extra.instance.setwindowlong(hwnd, winlong & ~ws_ex_layered); user32extra.instance.setwindowpos(hwnd, null, 100, 100, 100, ...

How to put ScrollView and OnTouchListener together in Android? -

Image
there scrollview on layout, has textview inside, scrolling text if 1 more field heigth. when implements ontouchlistener scrollview, default scroll of text doesn't work. how can scroll text , handle touchevent? example: swipe left , right - turn next quote, swipe , down - scroll invisible text

Reading multiple .dat files into MatLab -

i having great difficulties reading bunch of .dat files matlab. have tried google problem, after 1 hour still can't code work. in total have 141 .dat files. each file consist of 3 lines of header information (which not want include), , bunch of rows, each 3 columns of numbers. want merge rows .dat files 1 large matrix featuring rows, , 3 columns (since each row in .dat files contains 3 numbers). code have attempted use: d = dir('c:\users\kristian\documents\matlab\polygoner1\'); out = []; n_files = numel(d); = 3:n_files fid = fopen(d(i).name,'r'); data = textscan(fid,'%f%f%f','headerlines',3); out = [out; data]; end however, when try run code error message ??? error using ==> textscan invalid file identifier. use fopen generate valid file identifier. error in ==> readpoly @ 6 data = textscan(fid,'%f%f%f','headerlines',3); if knows how can work, extremely grateful! the problem when use f...

c# - Change Language programmatically Like english to french wpf -

i found tutorials , added 2 resources file properties folder of project , named them "resources.tr-tr.resx" , "resources.en-us.resx" , default "resources.resx" file there. set access modifier "public". , call in xaml code content="{x:static p:resources.mainwindow}" in files has values , can see reads correct. have menu button changes language , in action method write private void englishlanguagemenubutton_click(object sender, routedeventargs e) { system.threading.thread.currentthread.currentuiculture = new system.globalization.cultureinfo("en-us"); } or in action lets say private void macedonianlanguagemenubutton_click(object sender, routedeventargs e) { system.threading.thread.currentthread.currentuiculture = new system.globalization.cultureinfo("tr-tr"); } however system doesnt work. missing ? can dynamically change language ? or how can change resx file dynamically thanks tr...

nashorn - Effective way to pass JSON between java and javascript -

i'm new nashorn , scripting on top of jvm , wanted know if can java code , javascripts communicate more effectively. i'm using 3rd party js lib works js objects, , in java code have data want pass map<string, object> data . because 3rd party js expects work plain js objects can't pass data is, although script engine allows access map if plain js object. the script i'm using uses 'hasownproperty' on data argument , fails when invoked on java object. when tried using object.prototype.hasownproperty.call(data, 'myprop') didn't work , returned 'false'. basic problem java object not javascript object prototype. what ended doing : map<string, object> data; objectmapper mapper = new objectmapper(); string rawjson = mapper.writevalueasstring(data); scriptengine engine = new scriptenginemanager().getenginebyname("nashorn"); engine.eval('third_party_lib.js'); engine.eval('function dosomething(jso...

actionscript 3 - ActionScript3 FLV Player Video Transparency show on HTML Page -

i finding long time google, stackoverflow problem. have website project example: http://websiteactorlive.com i need transparent background (any) flv player as3. have transparent videos.. but, adding video in flv player wmode=transparent command on html. i not transparent video on html. tried: flowplayer, jwplayer also, have product http://activeden.net/item/video-player-reflection-multi-skin-local-youtube/114037 but product developer, said me "it doesn’t support transparent. can editing videoplayer.fla code" how can add codes transparency? or know methods problem? please me. sorry english. thanks..

javascript - Razor: Expand image as img tag from the string used in p tag -

i have view uses list model passed populate data. model view @model ilist<notedata> . class notedata contains 2 string variables anchor , data . values stored in data field can of following form detailed flipflop diagram <img src="http://cpuville.com/images/register_2.jpg"> use . i don't want directly display value string instead show image expanded img tag not able working. thank in advance suggestions for can use html.raw() method. method not encode string instead output pure html. like @html.raw(notedata.data) should display image tags. wary though output , html in string pure html, site may become vulnerable script injections if you're using method.

r - Figure name in caption using RMarkdown -

i writing first .rmd report using rmarkdown , knit pdf file. write in national language, have figures captions in language too. problem default caption format "figure 1: caption". change generative "figure 1:" part couldn't find how. appreciated. try specifying language in yaml header of rmarkdown document ( documentation link ): --- title: "crop analysis q3 2013" output: pdf_document fontsize: 11pt geometry: margin=1in lang: german --- the language code processed babel latex package (at least in case of pdflatex ).

php - Print array keys and values -

given table called "people" names of people associated city, need retrieve number of people come same city. people city john baltimore david london paula baltimore mark baltimore alex london my code follows: $array_cities = array(); $query = "select * people"; $result = mysql_query($query); if ($result) { while ($record = mysql_fetch_array($result)) $array_cities[] = $record['city']; } print_r(array_count_values($array_cities)); and in browser is: array ( [baltimore] => 3 [london] => 2 ) the output correct, not graphically good. want like: baltimore => 3 london => 2 are there other options it? that's output print_r() . if want else, loop through array print it: foreach(array_count_values($array_cities) $k => $v) echo $k . " => " . $v . " "; sidenote: besides print_r() there var_dump() , var_export() , "debugging functions...

java - input.equals("string here") not working -

i new java. i'm trying make program user inputs country , returns current time in country. have code: public static void main(string[] args) { scanner userinput = new scanner(system.in); system.out.println("enter country: "); string usercountryinput = userinput.nextline(); if (userinput.equals("philippines")) { date date1 = new date(); system.out.println(date1); } if (userinput.equals("russia")) { timezone.setdefault(timezone.gettimezone("utc + 05:30")); date date2 = new date(); system.out.println(date2); } } when enter "russia" or "philippines" not output anything. idea why? usercountryinput input variable. userinput scanner variable used input if ("philippines".equals(usercountryinput)) {

Insert Json data into SQL Server 2012 with PHP -

i parsing data json link insert 1 table in sql server 2012. parsing working well, problem inserting of data sql server. sample json data: "results": [ { "name": "the jpt on more - commercial transformation", "metrics": { "video": { "playthrough_75": "2981", "plays": "5466", "time_watched": "4030502288", "playthrough_100": "2288", "uniq_plays": { "monthly_uniqs": "4731", "daily_uniqs": "5136", "weekly_uniqs": "4991" }, script: $context = stream_context_create($opts); $content = file_get_contents($url, false, $context); $json = json_decode($content, true); foreach($json['results'] $item) { $videoname = $item['name']; $playthrough_75 = $item['metrics']['video']['playthrough_75']; $...

mysql - sql : allow same period for just two entries -

i have table provider (id , name, startdate , enddate ) confirm insertion of 1 provider on : 2 conditions: - there no other providers in period or second provider in period. i need make verification sql request select count(p.*) provider p p.startdate < :newenddate , p.enddate >= :newstartdate the use of < vs. <= , > vs. >= depends on notion of overlapping of intervals.

HTML5 + CSS3 layout - Vertical centering of picture (Solved) -

i'm trying vertical centering picture on page tried few scripts & styles none of them worked my page is: test.esc.bugs3.com i'm trying center "arrow" pic on left & right sides center of main pic today pic on "top" of div & wish put in in center note: don't wanna use fix size px wish make 50% main pic 100% height , arrow show on 50% of it layout - how wish like thanks :) edit: answers need side div (side box) vertical centered main div (center box) the main pic size not fixed (every media have different size - cant use px position change css sidepanel class below .sidepanel { width: 5%; height: auto; float: left; background-color: green; display: flex; justify-content: center; align-items: center; }

Memory leak in reading files from Google Cloud Storage at Google App Engine (python) -

below part of python code running @ google app engine. fetches file google cloud storage using cloudstorage client. the problem each time code reads big file(about 10m), memory used in instance increase linearly. soon, process terminated due "exceeded soft private memory limit of 128 mb 134 mb after servicing 40 requests total". class readgsfile(webapp2.requesthandler): def get(self): import cloudstorage gcs self.response.headers['content-type'] = "file type" read_path = "path/to/file" gcs.open(read_path, 'r') fp: buf = fp.read(1000000) while buf: self.response.out.write(buf) buf = fp.read(1000000) fp.close() if comment out following line, memory usage in instance change. should problem of webapp2. self.response.out.write(buf) it supposed webapp2 release memory space after finishing response. in code, not. sugg...

asp.net - ng-repeat not binding after successful ajax call -

i want use ng-repeat directive bind data div. though call successful , getting data , storing in scope variable im anot able use ng-repeat display it <div data-ng-app="myapp" id="sidestatus" style="position:fixed;top:50%;right:0;height:200px;width:200px;background-color:red;" data-ng-controller="myctrl">//wont bind here after successful execution <ul> <li data-ng-repeat="x in obj"> {{x.heading+' '+x.id+' '+x.name }} </li> </ul> </div> my javascript var app = angular.module("myapp", []); app.controller("myctrl", function ($scope, $http) { var obj2=new array(); $.ajax({ type: "post", url: "notifierservice.asmx/getdata", data: {}, contenttype: "application/json; charset=utf-8", data...

javascript - AngularJs: How to decode HTML entities in HTML? -

the situation: i bulding webpage content taken calling api returns data in json format. the problem html tags given html entities, has decoded. example: this example of json dealing with: &#60;p align=&#34;justify&#34;&#62;&#60;strong&#62;15&#60;sup&#62;th&#60;/sup&#62; here there bold text &#60;/strong&#62; here normal text... attempt: i have spend time research , seems harder thought. looking in google , similar question, possible solution use ng-bing-html api call: $http.get('http://api/page_content').then(function(resp) { $scope.content_test = resp.data[0].content; } filter: .filter('trusted', ['$sce', function($sce){ return function(text) { return $sce.trustashtml(text); }; }]) ng-bind-html in angular view: <div ng-bind-html=" content_test | trusted"></div> output: this output in view (exactly see it): <p align="justify...

html - How to use font awesome and resize the place holder name after responsive -

i using font awesome not working paragraph . saved font file in font folder. , how resize place holder name after responsive <html> <title> font awesome</title> <head> <link rel="stylesheet" type="text/css" href="style.css" /> <link href='http://fonts.googleapis.com/css?family=lato:300,400,700,900' rel='stylesheet' type='text/css'> </head> <body> <p>lorem ipsum dolor sit amet, consectetuer adipiscing elit. aenean commodo ligula eget dolor. aenean massa. cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. nulla consequat massa quis enim. donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. in enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. nullam dictum felis eu pede mollis pretium. integer tincidunt. cras dapibus. vivamus elementum semper nisi...

php - Get values after ajax request in json -

i have problem json after ajax request. when user click on submit button, ajax request looks if values correct. want return wrong field in json format , after in callback function. don't know how do. this call ajax : <script type="text/javascript"> $(document).ready(function(){ $('#submit_button_essai').click(function(){ $("td").eq(2).css("background-color","red"); $.post("ajax_insert_essai.php",{arr:data_essai}, insert_essai_callback); }); }); </script> and here ajax : $array = $_post["arr"]; $json = json_encode($array); $tab_erreur=array(); foreach($array $ligne)//boucle de parcours du tableau envoyé (hot) { foreach ($xml $table) { // boucle de parcours de chaque élément <table> (xml) foreach ($table $champs) { // boucle de parcours de chaque noeud <champs> de l'élément <table> (...

java - Servlet can't access from Smartphone or IE -

i have problem access servlet page smartphone or explorer. i open servlet page in eclipse. i can access in chrome using same address , local computer can't access explorer of local computer , smartphone. this servlet code: package awst.moon.btservlet; import java.io.ioexception; import java.io.printwriter; import java.sql.connection; import java.sql.drivermanager; import java.sql.preparedstatement; import java.sql.resultset; import javax.servlet.servletexception; import javax.servlet.annotation.webservlet; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; /** * servlet implementation class btservlet */ @webservlet("/btservlet") public class btservlet extends httpservlet { private static final long serialversionuid = 1l; /** * @see httpservlet#httpservlet() */ public btservlet() { super(); } /** * @see httpservlet#doget(httpservle...

php - Implementing my own utility functions in Lithium? -

i newbie lithium php , know basics of lithium. want implement own utility functions. have created utilities folder parallel app\controllers . how class looks like: <?php namespace app\utilities; class utilityfunctions { protected $_items = array( 'a' => 'apple', 'b' => 'ball', 'c' => 'cat' ); //i _items undefined here, blame poor oop skills. public function getitem(alphabet) { return $this->_items[alphabet]; } } ?> i use in controller as: <?php namespace app\controllers; use \app\utilities\utilityfunctions; class mycontroller extends \lithium\action\controller { public function index() { $args = func_get_args(); $item = utilityfunctions::getitem($args[0]); return compact('item'); } } ?> is right way it? utility class need extend something? or lithium provide other way achieve this? mo...

oracle - Single query: Bind Variables vs Literals -

i executing 1 query. of 2 queries, given below, take more time execute? select column2 sometable column1 = 'some value' and declare var1 varchar2; var2 varchar2; begin var2 := 'some value'; select column2 var2 sometable column1 = :var1 end;

jquery - Append .php json to javascript -

i have json result site 'www.example.com/jsonresult.php' { 1: { item_id: "balls", item2: "2", item3: "3", item4: "4" } } how append in jquery mobile javascript at $.ajax({ url: forecasturl, jsoncallback: 'jsoncallback', contenttype: "application/json", datatype: 'jsonp', success: function(json) { console.log(json); $("#current_temp").html('here'); $("#current_summ").html('and here'); }, error: function(e) { console.log(e.message); } });` please help, thanks. this how did it: $("#ul").html(myvar['1'].item_id); ...

javascript - Populating Bootstrap 3 Modal on Button Click -

i junior web developer , creating dynamic website. within website using javascript in order structure pages e.g. entering html var string , calling upon load on page when necessary. i trying use bootstrap modal various forms input data database. giving me trouble elements such datepicker not working assume because modal loads on click of button date picker loads on page load. anyway, wanted know if there way have content , custom javascript load when bootstrap modal button clicked e.g. var outputcontainer1 = $('#selectcraft'); $.ajax(apiprefix + '/craft' + apisuffix, { error: function() {}, success: function(data){ for(var in data){ $('#selectcraft').append('<option value="'+ data[i].id +'">'+data[i].aircraft_name+'</option>'); } }, type: 'get' }); as can see select element getting information database. want load on button click rather @ page-loa...

python - AUC-base Features Importance using Random Forest -

i'm trying predict binary variable both random forests , logistic regression. i've got heavily unbalanced classes (approx 1.5% of y=1). the default feature importance techniques in random forests based on classification accuracy (error rate) - has been shown bad measure unbalanced classes (see here , here ). the 2 standard vims feature selection rf gini vim , permutation vim. speaking gini vim of predictor of interest sum on forest of decreases of gini impurity generated predictor whenever selected splitting, scaled number of trees. my question : kind of method implemented in scikit-learn (like in r package party ) ? or maybe workaround ? ps : question kind of linked an other . scoring performance evaluation tool used in test sample, , not enter internal decisiontreeclassifier algo @ each split node. can specify criterion (kind of internal loss function @ each split node) either gini or information entropy tree algo. scoring can used in cross-v...

javascript - jQuery Select tables that match criteria -

i have table , within table, sub tables each entry. each entry $item. ui in question search facility can used send list of 'selected' items via ajax mail function. each item being table check box selected. however, when click check-box , select send, gets html 1 table, not selected. jquery('#search-query-send').click(function(){ jquery('.apartment-entry:has(:checked)').each(function(){ var content = jquery(this).html() console.log(content); }); }); check out fiddle i able console.log() html each table have selected. you got selector correct. jquery('#search-query-send').click(function() { jquery('.selectthis input:checked').each(function() { var content = jquery(this).parents('table').html(); console.log(content); }); }); http://jsfiddle.net/9d1pgjv8/7/

asp.net - Error : Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool -

we having error in our developed asp.net application. error below. deployed application many customers. 1 of them getting error every day. set max pool size tp 6000 in connection string error keeps occuring. i've analyzed data access layer closing connection strategy. there's no mistake in dal. when error thrown, executed sp_who or sp_who2 stored proceducer. there no open connection , connection list has average of 50-60 quantities. tried every method can't resolve problem. i'm having error since server changed sql 2008 r2 sql 2012. i suspect server has been changed or .net framework version. there error either caused running out of connections in pool if have set pool size 6000 (eeeek) won't that. the second cause connection timeout sql box, default 15 seconds should plenty can try increasing , see if less errors - if there wrong sql or connection between server , database. please please please make sure have our sqlconnections inside using blo...

javascript - Fitting multiple dependent datasets into AngualrJs ngRepeat -

i looking little bit of logically fitting 2 objects common reference angularjs ngrepeat . example objects (these called service): $scope.objarr1 = [ { id: 1, name: 'name 1', value: 'value 1', }, { id: 2, name: 'name 3', value: 'value 2', }, { id: 3, name: 'name 3', value: 'value 3', }, ]; $scope.objarr2 = [ { id: 1, name: 'name 1', value: 'value 1', objarr1: { id: 1, name: 'name 1', value: 'value 1', }, }, { id: 2, name: 'name 1', value: 'value 1', objarr1: { id: 1, name: 'name 1', value: 'value 1', }, }, { id: 3, name: 'name 1', value: 'value 1', objarr1: { id: 3, name: 'name 3', value: 'value 3', }, }, ]; something along lines. if can think of way; first array objects form buckets while second array objects form items fit corresponding bucket. first approach html: <ul> <li data-ng-repeat=...

javascript - JsHint {a} is not defined -

i need disable rule 117 jshint specific line, @ moment using /*jshint -w117 */ no success. any idea how fix it? _createdom: function () { //jscs:disable maximumlinelength var template = ''; /*jshint -w117 */ template += dojoconfig.app.hastools ? '<div id="paneldevelopment"></div>' : ''; template += '<div id="boundingboxes">'; //jscs:enable maximumlinelength } }; notes: seems working when /*jshint -w117 */ placed @ beginning of js file , not inside method. at time of writing couldn't work either; might need open bug. disabling rule didn't work when tried, though others seemed work in same context. as alternative, can specify white list of global variables via /* globals dojoconfig */ @ top of file as inline configuration ; might better explicitly declare undefined variables enable them entirely anyway. same @ project as linter ...

c - How to make a gtktextview drop to the next row when getting to the border of the window? -

i want make textview output strings may multiple rows long, , divide them when reach border of window. window set non-resizable, size fixed. i tried column , row numbers , work these, each character has different size in pixels, while row full of "m" characters reach end of row tenth character, row of "0" need sixteen characters end of line. any ideas? it seems want implement line wrapping in gtktextview. don't need yourself, text view widget supports line wrapping. turn on, call gtk_text_view_set_wrap_mode() text view , appropriate wrap mode, such gtk_wrap_char .

leaflet geojson icon according to value -

i loonking example of leafletjs geojson styled markers according data values (using "case" ?). have seen tutorial of can not find it... i know how assign icon (png) according data value geojson file. for example, geojson : var data = { "type": "featurecollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:ogc:1.3:crs84" } }, "features": [ { "type": "feature", "properties": { "size" : "s", "cat" : "a", "column1": "code 1234", "column2": "london" }, "geometry": { "type": "point", "coordinates": [ 55.1, -0.11 ] } }, { "type": "feature", "properties": { "size" : "s", "cat" : "b", "column1": "code 121314...

sql - select command inside then in case statement -

i got error following query in sql server 2008 subquery returned more 1 value. not permitted when subquery follows =, !=, <, <= , >, >= or when subquery used expression. i want use select command inside case statement after then below query declare @starttime datetime ,@endtime datetime ,@personid varchar(max) ,@supplierid uniqueidentifier = null set @starttime = '2011-1-22' set @endtime = '2012-1-27' set @personid = '2dd3cd60-4acc-4ff1-9956-2938099c08af,69186022-78b5-4bc6-9878-55b14a44a5aa,e64f0bf8-51cc-4c85-a4bd-2615d3ba7a52,53091d8b-2891-4c46-babd-1f0036ffe003,ea21226c-8be6-48de-a707-fe0edd0b62a3,f5ce7a19-a8da-4c0c-a233-861f9330361b' declare @table table (personid uniqueidentifier) insert @table select deviceid [dbo].[split](@personid, ',') create table #temptable ( person_id uniqueidentifier ,asset_id uniqueidentifier ,event_type_id int ,event_start_date datetime ,event_date datetime...

javascript - Cross domain ajax causing issues to render data -

i trying capture data html form placed on website. form need capture data website. when tried jquery ajax call cross domain shows me 302 error no response. i've tried this $('button[type="button"]').on('click', function(){ var data = $('.data-capture-form').serialize(); $.ajax({ type : 'post', url: 'http://prospectbank.co.uk/leads/test', datatype: 'jsonp', crossdomain : true, data : data, contenttype: 'application/jsonp' }).done(function(res){ var resp = $.parsejson(res); console.log(resp); }); }); where problem code? help? fiddle code if have access server, add following header: access-control-allow-origin: * and make jsonp calls $.ajax({ type: "post", datatype: 'jsonp', ...... etc .... if not have access external server, have direct ...

ios - How can I pull data from JSON by using swift -

i've been trying json string dictionary value, , can't work, i'm getting empty value. before tried pull data checked got json, i'm doing wrong here let jsonresult = nsjsonserialization.jsonobjectwithdata(data, options: nsjsonreadingoptions.mutablecontainers, error: nil) as! nsdictionary var items = [[string:string]()] var item:anyobject var authordictionary:anyobject var = 0; < jsonresult["item"]?.count; i++ { items.append([string:string]()) item = (jsonresult["items"] as? [[nsobject:anyobject]])! items[i]["content"] = item["content"] as? string items[i]["title"] = item["title"] as? string items[i]["publisheddate"] = item["published"] as? string authordictionary = item["author"] as! nsdictionary items[i]["author"] = item["displayname...

vb.net - How to load items from text file into listbox using multiple thread -

i'm using following code load text file items listbox in 1 of application , works size of text file more 10mb. application stuck few seconds @ time of loading items listbox. once item loaded works fine. there way reduce loading time , prevent application hanging. public sub loadfiles() dim systemdrv string = mid(environment.getfolderpath(environment.specialfolder.system), 1, 3) dim r io.streamreader r = new io.streamreader(systemdrv + "temp\test.txt") while (r.peek() > -1) listbox2.items.add(r.readline) end while r.close() end sub i read using multiple threads can solve problem. try few thing failed every time... multiple reading single file aren't solution, in cases won't reduce in loading time since access storage de facto sequential. can prevent application hanging wrapping in backgroundworker or in action . beware in windows form main thread has created form can modify component in form, need store resul...

java code to get all posts from Tumblr using the tag name -

i have tried posts tumblr using tag. http://api.tumblr.com/v2/tagged?tag=hadoop&api_key=***** i can write http client , can json , parse accordingly. want know information supported tumblr java api access this. i tried com.tumblr.jumblr.jumblrclient didnot found method supports requirement. can 1 suggest me in this. if @ jumblrclient.java in github can see method: /** * tagged posts * @param tag tag search * @param options options call (or null) * @return list of posts */ public list<post> tagged(string tag, map<string, ?> options) { if (options == null) { options = collections.emptymap(); } map<string, object> soptions = jumblrclient.safeoptionmap(options); soptions.put("api_key", apikey); soptions.put("tag", tag); return requestbuilder.get("/tagged", soptions).gettaggedposts(); } https://github.com/tumblr/jumblr/blob/master/src/main/java/com/tumblr/jumblr/jumblrclient.jav...

django - compare two objects [using fields dynamically] -

i need compare 2 objects, determine if field has changed or not class country(models.model): # country code 'mx' -> mexico code = models.charfield(max_length=2) name = models.charfield(max_length=15) class client(models.model): # id=1, name=pedro, country.code=mx, rfc=12345 name = models.charfield(max_length=100) country = models.foreignkey(country) rfc = models.charfield(max_length=13) > obj_db = client.object.get(id=1) > country = country.objects.get(code='mx') obj_no_db = client(**{'id':1, 'name':'pedro', 'country': country, 'rfc':12345}) > obj_db == obj_no_db # true > obj_no_db = client(**{'id':1, 'name':'pedro', 'country': country, 'rfc':1}) > obj_db == obj_no_db # true # isn't true because rfc has change, how can compare field field > obj_db.rfc == obj_no_db.rfc # false expected result i need build function generic, proble...

c# - Move label(change position) while scrolling local ReportViewer -

Image
i have windows form application . there 2 standart controls on form linklabel , reportviewer . data represented on reportviewer control long , there possible scrolling keep data reading. it's normal situation. need simple feature, when user scrolling or down, linklabel should move depend scrolling values or down, synchronously reportviewer content. linklabel location must fixed comparatively reportviewer initializecomponent method included: system.componentmodel.componentresourcemanager resources = new system.componentmodel.componentresourcemanager(typeof(hrcard)); this.reportviewer1 = new microsoft.reporting.winforms.reportviewer(); this.linklabel1 = new system.windows.forms.linklabel(); this.suspendlayout(); // // reportviewer1 // this.reportviewer1.dock = system.windows.forms.dockstyle.fill; this.reportviewer1.localreport.reportembeddedresource = "kad...

Download particular file during build time Gragle-Android -

is possible download particular file server during (grable)build process android project gradle build system. q1. setting parameter(url) in gradle script java code. can run during build process. q2. per parameter download particular file , place in android project. how 2 think possible if? i using android studio development.

How to open a terminal via intellij in the selected folder -

i want right click on file in intellij , open terminal there in mac. tried 'external tools' doesn't open terminal in selected directory though set $filedir$ working directory of tool you can drag selected folder , drop terminal window.

c - Address of register variable when it is taken as auto variable -

suppose, if no registers available in cpu, register variable taken auto variable. can apply & operator it? also, there way check whether variable register storage class stored in cpu or not? no. can't. standard quite clear on operators allowed applied on register storaged-classed variable regardless of whether actual register used or not: c11, 6.7.1 storage-class specifiers, p6 a declaration of identifier object storage-class specifier register suggests access object fast possible. extent such suggestions effective implementation-defined. 121 121) implementation may treat register declaration auto declaration. however, whether or not addressable storage used, address of part of object declared storage-class specifier register cannot computed, either explicitly (by use of unary & operator discussed in 6.5.3.2) or implicitly (by converting array name pointer discussed in 6.3.2.1). thus, operators can applied array declared ...

javascript - Unable to access scope variable inside a controller in Angular -

i have problem code. in app have 2 controllers 1 load data , second display tab. here's setup: <div class="row" ng-app="quotation_list"> <div class="col-md-12" ng-controller="quotelist"> <section ng-controller="panelcontroller panel"> <div class="panel pane-default" ng-show="panel.isselected(1)"> ... <div class="row"> <div class="form-group"> <label>vat(%): </label> <input type="number" class="form-control text-right" ng-model="vat_rate" /> </div> </div> <button class="btn btn-default" type="button" ng-click="computepercentage()">test value</button> ...

javascript - How to highlight part of an image and blur the rest? -

Image
i'm looking way similar effect above using css + javascript. ideally i'm looking javascript given object { top: 30, left: 10, width: 100 height: 300 } would produce effect on image #document on mouse enter , leave events can highlight part of image when mouse on it. so far have following: var highlight = function(sel, info) { $(sel).mouseenter(function() { var w = $(sel).width(); var h = $(sel).height(); $(sel + ' .box').css({ top: info.top + 'px', left: info.left + 'px', width: info.width + 'px', height: info.height + 'px', opacity: 1 }); $(sel + ' .overlay-a').css({ top: 0 + 'px', left: 0 + 'px', right: 0 + 'px', bottom: (h - info.top) + 'px', }); $(sel + ' .overlay-b').css({ top: info.top + 'px', left: 0 + 'px', right: (w - in...

how to add a container/widget/simple widget/vtl file dynamically in dotCMS -

scenario: have autocomplete country widget. when: i start typing country name in textbox, countries match query appears. lets type "co" , shows me "colombia" , "congo" in list. then select "congo". when select congo want call widget/container/vtl file/whatever brings me information want formatted way widget formatted. lest say, info of congo, location, population, brief description, etc. i tried restapi , thought of using dotparse()? i'm new on have no idea if possible. searched in docs, didn't find similar. so how can possible? i have widget created, need call via restapi? do have create container first? thanks in advance, help. thanks i it sounds want restful widget api. remote call return widget rendered. see: http://dotcms.com/docs/latest/widgetapi and http://dotcms.com/docs/latest/remote-widgets