Posts

Showing posts from August, 2015

asp.net - Fill Dropdown in asp dotnet from Caching -

i have dropdown in asp.net fills agent list. agent list 30,000. want keep data in cache dont need fill dropdown again , again database. how achieve caching. please guide suppose have cache varriable, have convert datatable , datatable tblcategories = (datatable) cache["categories"]; and , check, if still datatable empty, fetch database using loadcategoryindropdownlist() function takes data databse. if (tblcategories == null) { tblcategories = new datatable(); tblcategories=objdac.loadcategoryindropdownlist(); // inserts new row in filled datatable. //this new row contains static data user //instruction text such as" select item" datarow dr=tblcategories.newrow(); dr["categoryid"]=0; dr["categoryname"]="--select item--"; tblcategories.rows.insertat(dr,0); //cache datatable in cache memory duration of 1 hour... cache.insert("categories",...

restriction - How to set editable as true only for certain users in Fullcalendar -

i using fullcalendar project , wondering how possible set event editable selected users. i have tried doing didn't seem work editable: function (event) { if (event.createdby == "admin") { return true } else { return false } }, the editable option determines if events can dragged , resized. enables/disables both @ same time. not sure event.createdby call returns "admin"(or other user). first please check print on console.log() or alert(event.createdby); . if can show admin somehow, error in code(like missing semicolon(;) after return true , return false in code. if can take name (or id ) of 'selected user' variable createdby , eazy in code below: change code: editable: function (event) { if (event.createdby == "admin") { return true } else { return false } }, to this: editable: (createdby == "admin") ? true:false, or editabl...

ios - How can I have a value that will be calculated only in the next view? -

i'd make following transition animation: transition animation video how can have pin x,y target point of animation while in list view, can perform animation proper initial , final points? you should able use convertcoordinate:topointtoview method translate map coordinate cgpoint view. there's similar question here: convert mkannotation coordinates view coordinates

Facebook Post Id is null in OnActivityResult method of fragment in Android Application -

i trying show facebook post id in toast after have shared post using sharedialog in fragment,the control return onactivityresult of activity , calling fragment's onactivityresult activity's onactivityresult. in doing getting post id null.is there better way retrieve post id?

javascript - java script to get xml from url -

i writing js xml url not getting response.anything doing wrong? $(document).ready(function () { $.ajax({ type: "get", url: "http://www.w3schools.com/xml/simple.xml", datatype: "xml", success: function(response) { alert(response); } }); }); http://jsfiddle.net/4bh0qpb1/1/ first script syntax error (") have fixed, although can't access following url http://www.w3schools.com/xml/simple.xml using ajax due cors (cross-origin resource sharing) policy. reason cross-origin request blocked: same origin policy disallows reading remote resource @ http://www.w3schools.com/xml/simple.xml . can fixed moving resource same domain or enabling cors.

jQuery slide up and slide down -

by default questions displayed. on clicking 1 of questions related answer has displayed , other answers should hidden. (using slideup , slidedown methods ). you should use jquery toggle function <button>toggle</button> <div class="que"> <h4>your question one</h4> <p> answer one!! </p> </div> <div class="que" style="display: none"> <h4>your question two</h4> <p> answer two!! </p> </div> <script> $( "button" ).click(function() { $( ".que" ).toggle( "slow" ); }); </script> check here http://jsfiddle.net/k13oocfd/

php - cross domain rest api post put get delete -

i built rest api get, post, put, delete angularjs single page application . client wants host rest api in separate domain , angularjs single page application in domain. here @ development both angularjs application , rest api in same domain if move rest api domain calls rest api angularjs application comes under cross domain requests, tried jsonp call requests requests working , post, put, delete requests not working. how solve problem make post, put, delete requests rest api in different domain. if have access modify rest api try add code @ top. header('access-control-allow-origin: *'); header('access-control-allow-methods: get, post'); you change "*" angularjs application's domain name. hope you.

Filtering OCaml list to one variant -

so have list of stmt (algebraic type) contain number of vardecl within list. i'd reduce list stmt list vardecl list . when use list.filter can eliminate other types i'm still left stmt list . i found able filtering type change folding, can't figure out how generalize (i need pattern many places in project). let decls = list.fold_left (fun lst st -> match st | vardecl(vd) -> vd :: lst | _ -> lst ) [] stmts in is there better way perform filter , cast variant of list type? assuming have type like type stmt = vardecl of int | foo of int | bar | fie of string and stmt list, batteries lets do let vardecl_ints l = list.filter_map (function vardecl -> | _ -> none) l let foo_ints l = list.filter_map (function foo -> | _ -> none) l which think concise you're going get. don't think can make general "list-getters" adt's, because e.g. let bars l = list.filter_map (function b...

ruby - Why is spec failing? -

i have 2 specs. 1 written using defaults (i think selenium default?) , other using webkit. same, 1 fails other doesn't spec let(:admin) {create(:user, :admin)} let(:programme) { create(:programme, :full_payment_scheme) } before(:each) login_as(admin) visit edit_programme_path(programme) end scenario 'adding payment_scheme', js: true new_payment_scheme = create(:payment_scheme) visit edit_programme_path(programme) click_link 'add payment scheme' select new_payment_scheme.name, from: all('select[id*="programme_programme_payment_schemes_attributes"][id*="payment_scheme_id"]').last[:id] fill_in all('input[id*="programme_programme_payment_schemes_attributes"][id*="markup"]').last[:id], with: 50 fill_in all('input[id*="programme_payment_scheme_allocations_attributes"][id*="interval_weeks"]').last[:id], with: 10 fill_in all...

c# - Is there any automatic way to sync values of objects -

ide: vs 2010, c# .net winforms hi, having 3 objects obj1 obj2 , obj3, , obj1 values initiated , obj2 values initiated , want in obj3 final object contain values of both obj1 , obj2, see below examples: (the values merged if not null or 0. aclass obj1 = new aclass(); obj1.value1 = 14; aclass obj2 = new aclass(); obj2.value2 = 15; //i want aclass obj3 = new aclass(); obj3 = obj1 + obj2; // not available //i want obj3.value1 = 14 , obj3.value2 = 15 (initiated) is there faster or predefined way doing this. no, there's no built in support merging... , unless types of value1 , value2 int? , may not able tell difference between "not initialized" , "initialized 0". (if they're properties, give them custom setters , remember properties have been set way.) rather using + , suggest create own static method return merged instance: aclass obj3 = aclass.merge(obj1, obj2); you'd need write logic within method, of course. can't give sa...

java - Passing multiple values from Servlet to JSP but I get only 1 value in JSP -

i trying pass both latitude , longitude values servlet jsp 1 value in jsp servlet page for(int i=0;i<json.length();i++) { string lat=json.getjsonobject(i).get("lat").tostring(); string lon=json.getjsonobject(i).get("lon").tostring(); lats[i]=lat; lons[i]=lon; request.setattribute("lats", lats[i]); request.setattribute("lons", lons[i]); system.out.println(lats[i]+","+lons[i]); } jsp page var len=<%=request.getattribute("len")%>; lats[0]=<%=request.getattribute("lats")%>; <% string[] lats=(string[]) request.getattribute("lats");%> <% string[] lons=(string[]) request.getattribute("lons");%> for(i=0;i<len;i++) { var locations =[ ['<%=request.getattribute("cid")%>',lats,lon] ]; alert(locations); } where going wrong? as written, overwr...

Wrong Display Converting Array to XML Result in PHP -

i have trouble display xml in php. before it, converted array code xml. got array result oci_fetch_array while ($data = oci_fetch_array($stmt, oci_both)) { $parent = $data['parent']; if($data['parent'] == 0) { $idx++; $idx2 = 0; $product[$idx]['text'] = $data['name']; $product[$idx]['cls'] = "folder"; } else { $product[$idx]['children'][$idx2]['id'] = $data['id']; $product[$idx]['children'][$idx2]['name'] = $data['name']; $product[$idx]['children'][$idx2]['code'] = $data['code']; $idx2++; } } and array result: array ( [-1] => array ( [children] => array ( [] => array ( [id] => 4 ...

java - Crawl the web page content but got garbled -

i used httpclient 4.3.6 googleplay web page content , write local file,but text garbled such "鈥�",here code: //httpclient .... httpentity entity = response.getentity(); inputstream in = entity.getcontent(); byte[] b = new byte[2048]; stringbuffer out = new stringbuffer(); for(int n;(n=in.read(b))!=-1;) { out.append(new string(b, 0, n, "utf-8")); } because googleplay's response headers show "content-type:text/html; charset=utf-8" then used commons.io.ioutils ioutils.tostring(in, "utf-8"); the problem can't sovled. how should do

sql - Rails - Proper associations/data model for content display "cooldown" -

i have user model , content model. when user views piece of content, need make sure user not see content again say, 48 hours. what's rails way model out? i'd have table user_id, content_id, , timestamp view recorded, have worker clear out entries timestamps > 2 days. way when user requests more content, can filter out content has entry user_id , content_id match. don't think should matter, i'm using mysql rails 3.2. i think can following in model. class user < activerecord::base ... has_many :contents, -> { where(["extract(hour last_viewed_at) > ? or last_viewed_at ?", 48, nil)} end i used or condition make nil because when initialized or new record created user can able see it. i not sure how using worker. please suggest me if missing anything. not intended answer accurately, rather trying way can realize possible.

elasticsearch - Elastic search map multiple fields to a single field -

does elastic search provide functionality map different fields single field , use single field search. for eg _all refers fields in docs. similarly have mapping configuration define field referring multiple fields. eg : have field called brand,name,category. i need map brand , name single field custome_field. i want during mapping time , not during query time. know cross fields during query time. take @ copy_to functionality . acts custom _all . see here more this: in metadata: _all field explained special _all field indexes values other fields 1 big string. having fields indexed 1 field not terribly flexible though. nice have 1 custom _all field person’s name, , custom _all field address. elasticsearch provides functionality via copy_to parameter in field mapping: put /my_index { "mappings": { "person": { "properties": { "first_name": { ...

multithreading - Rails, ActionController::Live, Puma: ThreadError -

i want stream notification client. this, use redis pup/sub , actioncontroller::live . here streamingcontroller looks like: class streamingcontroller < actioncontroller::base include actioncontroller::live def stream response.headers['content-type'] = 'text/event-stream' $redis.psubscribe("user-#{params[:user_id]}:*") |on| on.pmessage |subscription, event, data| response.stream.write "data: #{data}\n\n" end end rescue ioerror logger.info "stream closed" ensure response.stream.close end end here js part listen stream: var source = new eventsource("/stream?user_id=" + user_id); source.addeventlistener("message", function(e) { data = jquery.parsejson(e.data); switch(data.type) { case "unread_receipts": updateunreadreceipts(data); break; } }, false); now if push redis, client gets push-notification. works fine. when click on ...

angularjs - Getting all directives that defined at module -

angularjs create [name]directive service each directive when define them. are there ways can set of directives have created in specific module? angular.module('mymodule',[]) .directive('aa',...) .directive('bb',...) .directive('cc',['alldirectiveservice',function(alldirectiveservice){ // can access directive here }]) in position declare submodule of main app module directives, that: if (window.myapp == null) { window.myapp = { myapp: angular.module('myapp', [ 'directives']), directives: angular.module('directives', []), }; } myapp.directives.directive('mydirective', [ function() { return { restrict: 'e', replace: false }; } ]); and suppose if console.log(myapp.directives); can see directives. havent tested think works.

YouTube Data API v3: ChannelSections.list gives strange results for some channels -

this duplicate of this issue , still unanswered. the problem channels (e.g. youtube movies or tv) channelsections invalid. to reproduce issue: call channelsections.list on (with snippet , contentdetails) channel ids ucl8dmtqdrjq0c8y23ubu4kq or ucczhp4wznqwono7pb8hq2mq. these valid channel ids movies , tv channels . check out api results here , here . the results should of defined type. should provide contentdetails (as requested) allow me present interesting things channel. however, results yield strange results of type " channelsectiontypeundefined ", , no contentdetails sections providing playlists/channels. notes: when browsing through youtube website , clicking through e.g. "popular on youtube" channel, stay on url links channel. however, "tv shows" , "movies", takes to, e.g. https://www.youtube.com/user/youtubeshowsus . should these channels handled in different manner asking channelsections?

c# 4.0 - Getting compile time errors after installing Box.V2 NuGet package -

i have installed lates box.v2 v1.1.4 nuget package c# class library project has framework 4.0. after installing project wrote below piece of code: var boxconfig = new boxconfig(clientid, clientsecret, redirecturl); var boxclient = new boxclient(boxconfig, null); var oauthsession = boxclient.auth.authenticateasync(authorizationcode).result; i have referred appropriate box namespaces in class file. after compilation below error: "the type or namespace name 'box' not found (are missing using directive or assembly reference?)" could please me figure out problem here? i created new project provided code , referenced package nuget. not getting compilation errors. have tried fresh project confirm behavior? if expand references node in project there yellow exclamation points?

javascript - Convert CKEDITOR to TextArea -

i have text area , button. on click of button i'm converting textarea ckeditor. additional requirement , on click of other button ckeditor must converted textarea. code: <textarea name="editor"></textarea> <input type="button" value="click" onclick="createeditor('editor')" /> <script type="text/javascript"> function createeditor(name) { var editor = ckeditor.instances[name]; if (editor) { editor.destroy(true); } ckeditor.replace(name, { toolbarstartupexpanded: false, autogrow_onstartup: true }); if (ckeditor.env.webkit) { ckeditor.on("instanceready", function (e) { document.getelementsbyclassname("cke_wysiwyg_frame cke_reset")[0].contentdocument.body.parentnode.contenteditable = "true"; if (typeof focusedelement !== 'undefined') { ...

Replace like in SQL Server 2008 R2 -

i have replace give string specific format. example : given string is : between 0 , 0:15 replace into : between '00:00:00' , '00:15:00' my attempt: declare @tm varchar(max) = 'between 0 , 0:15' declare @rep varchar(max) set @rep = replace(@tm,'0','''00:00:00'''); print(@rep); getting result : between '00:00:00' , '00:00:00':15 first answer it, believe want build sql string, query include quotes declare @tm varchar(max) = 'between 0 , 0:15' declare @st varchar(10), @et varchar(10) declare @rep varchar(max) --set @rep = replace(@tm,'0','''00:00:00'''); set @tm = ltrim(rtrim(substring(@tm, charindex(' ', @tm), len(@tm)))) -- remove between set @st = ltrim(rtrim(substring(@tm, 1, charindex(' ', @tm)))) -- start time set @tm = ltrim(rtrim(substring(@tm, charindex(' ', @tm) + 4, len(@tm)))) -- remove , set @et = ltrim(rtr...

javascript - 404 error because of ajax code? -

i have form action="" , many ajax codes validate or chain-select form elements below. ** current code (simplified) ** <?php if( isset( $_post['create_transaction'] ) ) { // } ?> <div> <!-- period information filled ajax --> <input type="text" name="period" class="form-control" id="period" readonly /> </div> <form id="form" method="post" action=""> <input name="r_date" type="date" value="<?php echo isset( $_post['r_date'] ) ? $_post['r_date'] : date( "y-m-d" ); ?>" class="transaction_date" /> <input type="submit" name="create_transaction" value="create" /> </form> <script> jquery(document).ready(function($) { // , that... /* period information if date filled on page load */ var ajaxurl = '<?php echo admi...

java - Is WSDL 2.0 supported in eclipse? -

i trying generate web service client wsdl 2.0 web service, but, eclipse ( version: luna service release 1 (4.4.1) build id: 20140925-1800 ) not seems recognize wsdl 2.0 , expects wsdl 1.0 syntax. as per eclipse installation details , it has web tools platform version 3.6.1 support in it . is there way enable eclipse handle wsdl 2.0 ? does eclipse supports wsdl 2.0 ? thanks & regards mandeep

c# - Connect local computers without local static IP -

i have 3 pcs, 1 server others clients. clients connects server entering server local ip. works problem occurs when router restarts , server assigned different local ip. now, need enter ip address again of server in clients. can solve using local static ip possible connect without setting local static ip ? edit: using tcp socket. use hostname connecting remote computer rather ip address. have rely on dns lookup though.

c# - Code-first 1..n mapping error -

i have these 2 models: public class product { public int id {get; set;} public int productgroupid {get; set;} } public class productgroup { public int id {get; set;} public virtual icollection<product> products {get; set;} } and mappings: public class productmap { this.totable("products"); this.haskey(t => t.id).property(t => t.id).hascolumnname("id") .hasdatabasegeneratedoption(databasegeneratedoption.identity); this.property(t => t.key).hascolumnname("id_product_group") .isrequired(); } public class productgroupmap { { this.totable("product_groups"); this.haskey(t => t.id).property(t => t.id).hascolumnname("id") .hasdatabasegeneratedoption(databasegeneratedoption.identity); this.hasoptional(t => t.products) .withmany() .willcascadeondelete(); } the code compiles when start app, following exception: invalid col...

java - javafx how to expand entire treeItem on button click event? -

in javafx, how expand entire treeitem on button click event ? i trying replicate accordion effect using treeitem due issues in scrolling while using accordion. please @ code snippet below- final treeitem<flowpane> rootitem = new treeitem<>(); root.setexpanded(true); (int = 0; < 12; i++) { treeitem<flowpane> rootitem1 = new treeitem<>(miniflowpane()); treeitem<flowpane> item1 = new treeitem<>(flowpanelarge()); rootitem1.getchildren().add(item1); rootitem.setexpanded(false); } final treeview<flowpane> tree; tree = new treeview<>(rootitem); tree.setshowroot(false); tree.setminwidth(450.0); tree.setmaxwidth(450.0); hbox listheaderbox = new hbox(); listheaderbox.setalignment(pos.center_left); button b = new button(">"); b.setonaction(new eventhandler<actionevent>() { @override public void handle(actionevent event) { } }); listheaderbox.getchildren().add(b); vbox listvbox = new vbox(5....

How to reference media files by using string array in android? -

in android program, have string array containing words, eg: string arr[]={"asong", "bsong", "csong"}; i have media files same name in res/raw folder. array size large(50-60 elements). want play raw files using r.raw.(arr[1]) or may equal r.raw.bsong, there way this? or have reference each 1 separately tradition? string arr[]={"asong", "bsong", "csong"}; (int = 0; < arr.length; i++) { int song= getresources().getidentifier("raw/" + arr[i], null, getpackagename()); inputstream inputstream = getresources().openrawresource(song); // play song logic here }

excel - Creating a button which matches 2 columns and put a value in 3rd column -

i want create button should populates data given condition: suppose have table 3 columns column1 column2 column3 3 b 4 b 3 4 b 4 the button should show data "b" value in column1 , "4" in column2. also, should put value "yes" in column3, if satisfies above condition. not sure if want delete values in column 1 , column 2 if not b or 4. private sub commandbutton1_click() = 2 6 'give range per requirement if cells(i, 1) = "b" , cells(i, 2) = 4 cells(i, 3).value = "yes" end if next end sub

c - Connection string to a remote DB2 db in another server -

i'm trying figure out connection string connect remote db2 using c db2 api (and odbc). far i've tried different options without success. documentation not clear @ second parameter of sqlconnect when defining data base name. sqlconnect(hdbc, "hostname/dbname", sql_nts, "user", sql_nts, "pass", sql_nts); sqlconnect(hdbc, "hostname:dbname", sql_nts, "user", sql_nts, "pass", sql_nts); // jdbc format... sqlconnect(hdbc, "odbc:db2://hostname/dbname", sql_nts, "user", sql_nts, "pass", sql_nts); thanks! the sqlconnect() function doesn't allow specify remote host details in servername parameter. can specify database alias name here. if database on remote server, need set connection parameters via db2 client (using catalog node , catalog database commands). however, can use sqldriverconnect() function , specify full details in connection string trying do.

unicode - How can I handle mal-encoded character with Python 2? -

the html file fetching has characters not supported encoding specified in html header: i found following ones not supported shift_jis encoding used. browser can correctly show characters. ∑ n-ary summation u+2211 ゚ halfwidth katakana semi-voiced sound mark u+ff9f Д cyrillic capital letter de u+414 when try read html file , decode processing, unicodedecodeerror. url = 'http://matsucon.net/material/dic/kao09.html' response = urllib2.urlopen(url) response.read().decode('shift_jis_2004') any way process html has mal-encoded characters without getting error? try this: response.read().decode('shift_jis_2004',errors='ignore')

uibutton - iOS accessibility - button focussed -

there 3 buttons in app, when voice on turned on , user swipes right, next button selected. note - button accessibility focus different button pressed. reason asking - want app announce "aaa" when button 1 selected , "bbb" when button 1 pressed. questions how can above achieved ? is there way call method when button selected. the view (in case button) needs implement protocol uiaccessibilityfocus - (void)accessibilityelementdidbecomefocused - (void)accessibilityelementdidlosefocus - (bool)accessibilityelementisfocused

Swift function Generic -

i user swift function return class or a's subclass like func test(tst: int) -> { if(tst == 1) { return a() } else { return b() } } b subclass of a when return b. use dynamictype it's type. return type a. how can real type.

amazon web services - AWS EB, Play Framework and Docker: Application Already running -

i running play 2.2.3 web application on aws elastic beanstalk, using sbts ability generate docker images. uploading image eb administration interface works, gets state consistently following error: docker container quit unexpectedly on thu nov 27 10:05:37 utc 2014: play server process id 1 application running (or delete /opt/docker/running_pid file). and deployment fails. cannot out of doing else terminating environment , setting again. how can avoid environment gets state? sounds may running infamous pid 1 issue. docker uses new pid namespace each container, means first process gets pid 1. pid 1 special id should used processes designed use it. try using supervisord instead of having playframework running primary processes , see if resolves issue? hopefully, supervisord handles amazon's termination commands better play framework.

How to display the image from database in android imageview -

hi in application getting json response in image there.that image want display in android imageview.in image want set imageview. picture":"547150_156322317826149_1332901104_n.jpg can 1 me well, suppose got picture url, suggest try code: create simple imageview in main.xml file: main.xml: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <textview android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="loading image url" android:layout_margin="10dip" /> <imageview android:id="@+id/image" android:layout_height="wrap_content" android:layout_width="fill_...

sharepoint - JavaScript - browserHandler is undefined -

i´m not javascript dev. sharepoint 2010 site custom code (running on sharepoint 2013) not work correctly. click event on link not working. when i´m using debuger (ie f12) message "browserhandler undefined". is following code correct? var browserhandler; if (element.addeventlistener) { browserhandler = function (e) { return handler.call(element, new sys.ui.domevent(e)); }; element.addeventlistener(eventname, browserhandler, false); } else if (element.attachevent) { browserhandler = function () { var e = {}; //message: browserhandler undefined try { e = sys.ui.domelement._getwindow(element).event; } catch (ex) { } return handler.call(element, new sys.ui.domevent(e)); }; element.attachevent('on' + eventname, browserhandler); }

bash - Find negative numbers in file with grep -

i have script reads file, file looks this: 711324865,438918283,2 -333308476,886548365,2 1378685449,-911401007,2 -435117907,560922996,2 259073357,714183955,2 ... the script: #!/bin/bash while ifs=, read childid parentid parentlevel grep "\$parentid" parent_child_output_level2.csv resul=$? echo "child $childid, parent $parentid parentlevel $parentlevel resul $resul" done < parent_child_output_level1.csv but not working, resul allways returning me 1, false positive. i know because can launch next command, equivalent, think: [core@dub-vcd-vms165 generated-and-saved-to-hdfs]$ grep "\-911401007"parent_child_output_level2.csv -911401007,-157143722,3 please help. your title inconsistent question. title asks how grep negative numbers, avinash raj answered well, although i'd suggest don't need (perl-style) look-behind positive assertion (^|,)\k match start-of-field, because if file well-formed, -\d+ ma...

web services - How to change the wsdl url of cxf endpoint? -

i trying create proxy service using apache camel through camel configuration file. i have created proxy service version webservice of axis 2 . the problem , proxy service final wsdl url , address both point same url. here camel-config.xml file part : <cxf:cxfendpoint id="securityservice" address="https://0.0.0.0:9080/services/version.securityhttpssoap11endpoint" endpointname="s:version.securityhttpssoap11endpoint" servicename="s:version" wsdlurl="etc/version.wsdl" xmlns:s="http://axisversion.sample"/> now problem above configuration, if have see wsdl of above service. wsdl url be: https://0.0.0.0:9080/services/version.securityhttpssoap11endpoint?wsdl and soap address location : soap:address location="https://0.0.0.0:9080/services/version.securityhttpssoap11endpoint" now want wsdl ...

c - Register variable storage class error -

kindly me error: error: storage class specified 'interrupt_save_disabled' #define tx_interrupt_save_area register unsigned int interrupt_save_disabled; this header file in used: #if defined (win32) || defined (linux) #define register #endif tx_interrupt_save_area you can't have register on global variable. remove specifier.

angularjs - What is wrong with this controller? -

the code below create controller within index.htmls <script></script> doesn't work. wrong here? know can make work having separate app.js , define there. interested know why doesn't work. <!doctype html> <html data-ng-app> <head lang="en"> <meta charset="utf-8"> <title></title> </head> <body> <div data-ng-controller="skillscontroller"> <ul> <li data-ng-repeat="skill in skills">{{skill.name}} - {{ skill.stars}}</li> </ul> </div> <script> function skillscontroller($scope) { $scope.skills = [ { name: 'ruby', stars: 5 }, { name: 'java', stars: 10} ]; } </script> <script type="text/javascript" src="js/angular.js"></script> </body> </html> use you check link http://plnkr.co/edit/ukdbnq9ulk43m9xsq9yu?...

dynamic sql - Dynamically assigning variables oracle sql -

i have table attribute_config below columns: table_name column_name key let has below 2 rows account accountphone accountnum customer customernumber customerid key can accountnum or customerid. i have write code accept (i_accountnum,i_customerid) and; fetch respective values columns mentioned in column_name in tables mentioned in table_name using key in condition. for ex: select accountphone account accountnum = i_accountnum select customernumber customer customerid = i_customerid the complete query should formed dynamically, whether pass i_accountnum or i_customerid in query needs decided dynamically. if key - accountnum, i_accountnum passed condition. i have been trying on these lines far, not working, know wrong. declare v_accountnum varchar2(20); v_customerid varchar2(20); v_attribute_value varchar2(20); v_stmt varchar2(255); begin account_num := 'testcustomer'; -- input function v_customer_ref := 'testaccount'; -- input function ...

java - how to output the table data from database extends jpanel with scrollbars -

public class mydatabase extends jpanel { string sql; //string tablename; public mydatabase(){} public mydatabase(string sql) { system.out.printf("hai"); arraylist columnnames = new arraylist(); arraylist data = new arraylist(); // connect mysql database, run query, result set // this.tablename=tablename; this.sql =sql; // ensure sql objects closed when program // finished them try { connection con=databaseconnection.getconnection(); statement stmt=con.createstatement(); resultset rs = stmt.executequery( sql ); resultsetmetadata md = rs.getmetadata(); int columns = md.getcolumncount(); // column names (int = 1; <= columns; i++) { columnnames.add( md.getcolumnname(i) ); } // row data while (rs.next()) { ...

javascript - Searching div content through the text entered in a search box -

Image
i want implement functionality user can search different brands available us. see image i'm looking for: want search & replace div brands matching search. i'm looking idea here, can ajax call hope can simple javascript. getting load time low possible. ideas whether can simple javascript? <input type='text' placeholder='search' class='text'><br> <input type='checkbox' id='a'>a<br> <input type='checkbox' id='b'>b<br> <input type='checkbox' id='c'>c<br> <input type='checkbox' id='d'>d<br> simple html here (with no javascript code): http://jsfiddle.net/22nm8o34/ here suggestion. html: <input type='text' placeholder='search' class='text'><br> <span class="checkbox-wrapper" id="a"><input type='checkbox' id='a...

c# - .NET Gadgeteer how to get response from web service -

i'm beginner when comes .net gadgeteer programming managed find how can send data web service how receive i'd control gadgeteer using website need pass values when necessary i'd know should start learning can't find decent developer guide or such don't know of functions mean. simple explanation or beginner examples help. it depend on version of gadgeteer using, here simple code have used on our physical charts written (though using gadgeteer 4.3 .net micro framework 4.2) in c# on spider main-boards. try it. [...] using gadgeteer.networking; [...] var request = httphelper.createhttpgetrequest(_getcurrentdemourl + _id); request.responsereceived += getdataresponsereceived; request.sendrequest(); [...] private void getdataresponsereceived(httprequest sender, httpresponse response) { debug.print(response.statuscode + ": " + response.text); if (response.statuscode == "200") { datareceived(response.te...

spreadsheet - Convert text cells to DATE, but leave empty and DATE cells intact -

Image
sorry ignorance have no idea spreadsheets. what have column contains dates there in different format text '19.12.2006 , others cells formated date 2009-10-10 i want them date cells, found formula =datevalue what done put =if(a2="";"";datevalue(a2)) for dates in text format done well, empty cells it's ok well, when cell date cell have err: 502 can please me? as you've discovered, datevalue expects string looks date, not actual date. however, there nothing stopping taking dates , converting them strings text . right format mask can distinguish between dates , string dates you.          the formula in n1 is, =if(isblank(m1); ""; datevalue(text(m1; "mmm dd, yyyy;@"))) this formats actual date string date , leaves string dates alone. there seemed dd/mm/yy vs mm/dd/yy issue between sample data , regoinal system used complex date format date format do. @ stuck on end catch strings. result processed datev...

c# - The Name 'CommonFolderQuery' does not exist in current context -

i trying music files windows phone 8.1 , want group them artist. following documentation . // music folders present in music library ireadonlylist<istorageitem> musicfolders = await knownfolders.musiclibrary.getfoldersasync(commonfolderquery.groupbyartist); but error shown. reason? did miss using directive or assembly reference?? the commonfolderquery enumeration located in windows.storage.search namespace. make sure you've included using directive @ top of file: using windows.storage.search;

java - Print Axis2 Request Response XML -

i want print raw request response xml console. have created stubs using wsdl2java axis2. wsdl2java has created 2 java files, 1 stub , 1 callbackhandler. i trying below method getting null value operationcontext.getmessagecontext("out"); / operationcontext.getmessagecontext("in");. code public void soaploghandler(stub stub){ servicecontext serviceconxt = stub._getserviceclient().getservicecontext(); //**** enable cache hold last operation operationcontext operationcontext = new operationcontext(); boolean cachelastoperationcontext = true; operationcontext.setcomplete(true); // enable cache value serviceconxt.setcachingoperationcontext(cachelastoperationcontext); serviceconxt.setlastoperationcontext(operationcontext); operationcontext operationcontext = serviceconxt.getlastoperationcontext(); if (operationcontext != null) { messagecontext outmessagecontext = operationcontext.getmessagecontext("out"); operationcontex...

c++ - cmake: In which order do I have to specify TARGET_LINK_LIBRARIES -

i struggling again , again linker problems since 1 has specify libraries within target_link_libraries in correct order. how can determine order? example: i have following libraries liba depends on boost libb depends on postgresql , liba (and therefore on boost) mytarget uses liba, libb , boost directly (and through libb depends on postgresql) since required libaries linked if executable created have specifiy libraries when linking mytarget (the final executable): target_link_libraries(${applicationname} libboost_program_options.a libboost_system.a libboost_filesystem.a libboost_date_time.a libboost_regex.a # should include boost libraries strangely libs (the ones above) # need specified "by hand"??? ${boost_libraries} # postgresql stuff libpq.a libsoci_core.a libsoci_postgresql.a libpq.so # libs libb.a liba.a ${cmake_thread_libs_init} # pthreads, needed boost ${cmake_dl_libs} # libdl.so etc. ) since linking boost static cmakelists.txt contains se...

ios8.1 - how to convert Int32 value to CGFloat in swift? -

here code, let width = cmvideoformatdescriptiongetdimensions(device.activeformat.formatdescription cmvideoformatdescriptionref!).width -- return int32 let height = cmvideoformatdescriptiongetdimensions(device.activeformat.formatdescription cmvideoformatdescriptionref!).height -- return int32 mylayer?.frame = cgrectmake(0, 0, width, height) error ' int32 ' not convertible cgfloat , how can convert int32 cgfloat? to convert between numerical data types create new instance of target type, passing source value parameter. convert int32 cgfloat : let int: int32 = 10 let cgfloat = cgfloat(int) in case can either do: let width = cgfloat(cmvideoformatdescriptiongetdimensions(device.activeformat.formatdescription cmvideoformatdescriptionref!).width) let height = cgfloat(cmvideoformatdescriptiongetdimensions(device.activeformat.formatdescription cmvideoformatdescriptionref!).height) mylayer?.frame = cgrectmake(0, 0, width, height) or: let width = cmvideo...

python - Beginner can't clear some lines into this code for LCD Screen -

here part of code screen words on lcd screen raspberry pi. it's work fine can't clear screen between each groups of words. moment : new word written while last words remains on screen code : def typewriter_like(sentence, lcd_line, delay=0.7): i,letter in enumerate(sentence): lcd_byte(lcd_line, lcd_cmd) lcd_string(sentence[:i+1],1) time.sleep(delay) mots = (("example", "examples", "exampless", "examplesss"), ("one", "two", "three", "four"), ("lulu", "fifi", "lolo", "riri"), ("new", "neww", "newww", "newwww")) lcds = (0x80, 0xc0, 0x94, 0xd4) list(zip(mots,lcds)) [(('example', 'examples', 'exampless', 'examplesss'),128),(('one', 'two', 'three', 'four'),192),(('lulu', ...

html - php preg_match accept alnum and chinese characters -

i preg_match syntax to accept letters , numbers (numbers alone not allowed) disallow spaces disallow special characters (e.g !@#$%^&.,) minimum of 3 chars 12. allow chinese characters (can alone, or letters or numbers, or both.) this attempted code, seemed fail goal if(preg_match('/^[a-za-z0-9\x{4e00}-\x{9fa5}]{3,12}+$/', $nickname)) { //accepted } else { //denied } thanks in advance. change code below. ^(?!\d+$) won't allow strings contain numbers. if(preg_match('~^(?!\d+$)[a-za-z0-9\x{4e00}-\x{9fa5}]{3,12}+$~u', $nickname)) { //accepted } else { //denied }

javascript - jQuery UI Modal Destroy Form Submit -

form submitted multiple times when destroy modal , reopen again. although in modal contain 1 form: please how prevent / submit 1 form on dialog! html: <a href="modal.php" class="mymodal" title="submit form">open modal</a> modal.php file <form id="myform" role="form"> <div><label>username:</label> <input type="text" name="uname"></div> <div><label>message:</label> <input type="text" name="message"></div> <div><input type="submit" name="submit"></div> </form> js: $('body').on('click','.mymodal', function(e){ var $this = $(this); var output = $('<div id="uimodal-output" title="'+$this.prop('title')+'"></div>'); $('body').append(output); output.load( $this.attr(...

javascript - Slow down setAttribute() -

is possible slow down setattribute()? example, have following code: function hide(i) { var previewdiv = document.getelementbyid('preview'); var fulldiv = document.getelementbyid('full'); previewdiv.setattribute('style', 'display:normal;'); fulldiv.setattribute('style', 'display:none;'); } now want make display:none go display:normal delay "fades" open instead of bluntly open. or there way achieve this? it can done in multitude of ways. use jquery's fadein method $('.element').fadein(); or using css , javascript. found example http://www.chrisbuttery.com/articles/fade-in-fade-out-with-javascript/ chris buttery. i comes down taste. although 1 argue second option should more optimal on systems.

c# - Replace the contents of a WPF grid after a button click -

i'm trying modify c# kinect sample (kinect fusion explorer). in main window application, there grid diplays 3d rendering of kinect fusion feed. i know if possible replace contents of grid after clicking button in form. <grid x:name="compositehost" grid.row="0" grid.column="0" grid.rowspan="2" horizontalalignment="left" cliptobounds="false" > <viewbox grid.column="0"> <image name="shadedsurfaceimage"/> </viewbox> <viewport3d name="graphicsviewport" ishittestvisible="false" > <!-- 3d elements added here programatically, performance can add following line above: renderoptions.edgemode="aliased" --> </viewport3d> </grid> right feed uses viewport3d output feed. output simple video feed after button click. here xaml looks simple video feed: <grid> <image name="videoima...

Error during a git clone on a private repository (Centos) -

i'm using centos , have weird error when try clone private repository github.com i git clone https://github.com/clemzd/gclchallenge.git and error : initialized empty git repository in /home/makeitgreen/documents/gclchallenge/.git/ error: requested url returned error: 403 forbidden while accessing https://github.com/clemzd/gclchallenge.git/info/refs fatal: http request failed it sounds didn't configure git well. remember did save password , error comes don't know how cancel this. git config --global credential.helper wincred i tried on machine , works because ask me credentials. thank help! solution : centos had git version < 1.7.9 , had specify credentials part of url i've improved version 2.2.0 , works! why specifying wincred being on centos? can try unsetting them git config --global --unset credential.helper then read http://git-scm.com/docs/gitcredentials or is there way skip password typing when using https:// github ...

Hosted streaming server -

i have videos needs played in schedule tv. stream published in ios , android devices via native app. need know easy use hosting provider can me on easy upload videos , schedule. -souvik a hoster not exist far know. there hosters provide basic infrastructure u trying archieve though. there opensource solution red5 or paid options wowza , adobe media server.

java - awaitDone in FutureTask throwing InterruptedException -

i've been searching web week none of posts how futuretask return after timeoutexception? seems answer question. i've extracted code sample code: future<object> result = executorservice.submit(new callable<object>() { @override public object call() throws exception { ........... } }); try { return result.get(timeout.getvalue(), timeout.getunit().gettimeunit()); } catch (timeoutexception e) { result.cancel(true); throw new ttimeoutexception(e); } if run this, sometimes(1 out of 1000) i'm getting java.lang.interruptedexception @ java.util.concurrent.futuretask.awaitdone(futuretask.java:400) @ java.util.concurrent.futuretask.get(futuretask.java:199) @ com.abc.callers.a.call(a.java:83) and line no:83 result.get() of future task shown in above code sample. now question is, can calling result.cancel(true) in future cause interruptedexception in result.get? if not, can change interrupt status of ...

http - export neo4j data to JSON with cURL -

curl -b -j "content-type: application/json" -d '["quer y:"{"match n return n"}]' http://localhost:7474/db/data/ curl: (6) not resolve host: content-type hello, i want json from. curl , write local file. can other things it. but when executing command not resolve content-type. i've tried: curl -b -j content-type: application/json' without double quotation mark ("") but result curl: (6) not resolve host: content-type curl: (6) not resolve host: application now i've fixed syntax error curl -b -j -d '["query:"{"match n return n"}]' http:// localhost:7474/db/data/ -o . % total % received % xferd average speed time time time current dload upload total spent left speed 100 28 0 0 100 28 0 13 0:00:02 0:00:02 --:--:-- 13 but no data:( i had success with: curl -b -j -h "content-type: app...

html - jquery ajax success not finding variable div -

i have following code: <script> function initialdata() { var patches = [<?php echo $jspatcharray ?>]; (i = 0; < patches.length; i++) { var dividpatch = "\"#initialdata-" +patches[i]+ "\""; $.ajax({ type: "get", url: "initial_data.php", data: {patch:patches[i]}, success: function( data ) { $( dividpatch ).html( data ); } }); }; var dividcount = "#srcount"; $.ajax({ type: "get", url: "sr_count.php", success: function( data ) { $( dividcount ).html( data ); } }); } </script> <?php $_session['patchobjs'] = array(); foreach ($arrayrelqa $patch) { echo "\n"; echo '<div id="initialdata-'.$patch.'"></div>'; } echo "\n<div id=\"src...