Posts

Showing posts from May, 2013

Save XML response from GET call using Python -

i'm trying create realtime report using api allows me grab data need , returns in xml format. want know is, after receiving response, how can save .xml file locally? or cache it, way can parse before parsing response. import requests r = requests.get('url', auth=('user', 'pass')) i'm using requests since it's easiest way make call in opinion. also, first question , i'm barely starting learn python, i'd appreciate if guys had little patience. thanks. i looking @ similar question json, not sure if work same, https://stackoverflow.com/a/17519020/4821590 import requests import json solditems = requests.get('https://github.com/timeline.json') # (your url) data = solditems.json() open('data.json', 'w') f: json.dump(data, f) if want able parse returned xml before doing stuff it, xml tree friend. import requests import xml.etree.elementtree et r = requests.get('url', auth=('user',...

ios - How to set an object to nil in Swift? -

i'm implementing simple stack in swift. ran unexpected behavior while writing pop() , i'm hoping can explain why happening. i wrote original pop function this: class func pop(inout head : node)->node? { var currentnode : node? = head while currentnode!.next != nil { currentnode = currentnode!.next! } var lastnode = currentnode currentnode = nil return lastnode } basically, i'm finding tail of linked list , setting object nil. however, item retained, can see in console output: //traversing initial list 10 11 12 13 14 popped: 14 //list after popping 10 11 12 13 14 as can see, 14 not removed, though returned pop() function correctly. now, second thought set previous node's next pointer nil, edited above function read this: class func pop(inout head : node)->node? { var currentnode : node? = head var previousnode : node = head while currentnode!.next != nil { previousn...

c# - ForeignKey String ToLower Entity Framework -

i have problem foreignkey, see in database table have following value "la urbina" in column "equ". in model property is: [foreignkey("equipo")] public string equ { get; set; } private equipo equipo; public virtual equipo equipo { { return equipo; } set { equipo = value; } } the problem in table "equipo" key code "la urbina" not "la urbina" , therefore not make relationship, idea make comparison regardless if value lower or upper? please excuse bad english, hope understand me , can me you must check "collation" database using. for example, "latin1_general_100_cs_ai" - cs indicates strings in database "case-sensitive" , string "la urbina" , "la urbina" different. if ""latin1_general_100_ci_ai" - ci indicates string in database "case-insensitive" , there no differences between 2 strings. in order change database collation, r...

linq - Remove objects, and child objects from a list in C# where they match an object property in another list -

i need c# linq query remove objects in list based on whether match property in list. in addition, objects can contain children of same type , need remove them if there not match. in example, want remove children of children. match doesn't need hierarchical - basic match. here classes , failed attempt. awesome! public class gsdmegamenu { public int id { get; set; } public int portalid { get; set; } public int tabid { get; set; } } public class menuitem { public int id { get; set; } public int portalid { get; set; } public int tabid { get; set; } public list<menuitem> children { get; set; } } list<gsdmegamenu> megamenuitems = gsdmegamenu.getallgsdmegamenus(); rootnode.children.removeall(x => !megamenuitems.any(y => y.tabid == x.tabid)); if need process children of children have explicitly loop though them. removeall not linq method it's method on list cl...

python - What is the Big-O performance of this algorithm and how do I solve this normally? -

hello have algorithm having trouble finding performance. i=math.ceil(n**0.5) while n % != 0: -= 2 would o(2^n)? i don't know trying do, current code run give error cannot divide zero many cases example n=13 , if i-=1 in place of i-=2 code work fine without error every n , complexity o(n^(1\2)) .

java - Updating class field from callback -

i'm trying connect api using retrofit . need login user , after set "user" field contains session key required other api calls. need have available before executing code don't know how check or block code until field set. ideas how it? public class apiclient { public static final string developerkey = ""; public static final string applicationkey = ""; static final string base_url = "https://secure.techfortesco.com/tescolabsapi"; public apiservice mapiservice; public user user; public apiclient() { restadapter restadapter = new restadapter.builder() .setloglevel( restadapter.loglevel.full ) .setendpoint( base_url ) .build(); if(mapiservice == null) { mapiservice = restadapter.create( apiservice.class ); } } public void login() { mapiservice.login( developerkey, applicationkey, new callback<user>() { @override public void success ( use...

javascript - fadeIn() elements in array, randomly (ie, not in order), at different times -

i have several sentences written, "words" within tags, same class. have managed fill array elements. however, appear @ same time, , in order down paragraph in sequential order (ie, if element 5 first printed, n+1 element greater 5, , on) also, in loop, if for(var i=0; i < numelements ;i++) .....32 number of unique elements. must set numelements way larger 32. ie elements not appear unless numelements >=90. why this? attempt: $(document).ready(function() { var spanarray = []; var spanlength, index; /* populate array elements of class .fadein */ $(".fadein").each(function() { spanarray.push(this); }) spanlength = (spanarray.length); for(var = 0; < 33; i++) { index = math.floor(math.random() * (spanarray.length)); $(spanarray[index]).delay(400).fadeto(500,1, function() { $(spanarray).splice(index,1); }); } }); jsfiddle basically: all elements appear @ same ti...

sql - What am I doing wrong with this loop in MySQL -

here question i'm trying answer: write script calculates common factors between 10 , 20. find common factor, can use modulo operator (%) check whether number can evenly divided both numbers. then, script should print lines display common factors this: common factors of 10 , 20 1 2 5 here code: use myguitarshop; if object_id ('test') not null drop procedure test; create procedure test () begin declare counter int declare fact10 int; declare fact20 int; declare factors varchar (100); set fact10 = 10; set fact20 = 20; set counter = 1; set factors = 'factors of 10 , 20'; while (counter <= 10/2) if (fact10 % of counter = 0 , fact20 % of counter = 0) set factors = contact (factors, counter, ' '); end; this error keep getting: msg 102, level 15, state 1, procedure test, line 6 incorrect syntax near ')'. msg 155, level 15, state 2, procedur...

java - Android setTextOn not working in onCheckChanged method -

Image
these next 2 statements produce correct screen below left: if(ischecked) sw.settext ("this switch is: on"); else sw.settext ("this switch is: off"); according text i'm looking at, these next 2 statements should produce screen on left. produce incorrect screen below right: if(ischecked) sw.settexton ("this switch is: on"); else sw.settextoff("this switch is: off"); the code: package com.dslomer64.checkbox; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.widget.checkbox; import android.widget.compoundbutton; import android.widget.switch; public class mainactivity extends actionbaractivity{//} implements compoundbutton.oncheckedchangelistener { checkbox cb; switch sw; @override protected void oncreate(bundle savedinstan...

jquery - Toggle menu error -

i getting error when site goes mobile , try , open nav menu referenceerror: e not defined e.preventdefault(); here jquery using <script> $(document).ready(function() { $('#menu-toggle').click(function () { $('#menu').toggleclass('open'); e.preventdefault(); }); }); </script> any great. in document.ready(function()) pass e function $(document).ready(function(e)) . should solve problem.

ios - Simple Parse.com with findObjectsInBackgroundWithBlock does not return -

i trying query _user class parse use on tableviewcell. getting nil value it. did have working @ 1 time simpler, not recommended, query: working query (not recommended): - (nsarray *)loadusers { pfquery *users = [pfuser query]; return [users findobjects];} not working query: - (void)loadalluser:(void (^)(bool completion))completion { pfquery *query = [pfuser query]; __block nsarray *loadusers = [nsarray new]; [query findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error) { if (!error) { (user *user in objects) { loadusers = [loadusers arraybyaddingobject:user]; } [taskcontroller sharedinstance].loadalluser = loadusers; }else { nslog(@"error: %@ %@", error, [error userinfo]); } }]; } i subclassing _user class parse (just fyi) the problem when method called. numberofrowsinsection not passing nil value.

java - Spark Converting JavaDStream<String> method to JavaPairDStream<String, String> method -

i have function in spark streaming code splits tweets individual words javadstream<string> words = statuses .flatmap(new flatmapfunction<string, string>() { public iterable<string> call(string in) { return arrays.aslist(in.split(" ")); } }); i need modify returns words , original tweet against each word. have tried below, getting java.lang.classcastexception: scala.tuple2 cannot cast java.lang.iterable error during run time. javapairdstream<string, string> wordtweets = statuses.flatmaptopair( new pairflatmapfunction<string, string, string>() { public iterable<tuple2<string, string>> call(string in){ tuple2<string, string> tuple2 = new tuple2(arrays.aslist(in.split(" ")), in); return (iterable<tuple2<string, string>>) tuple2; ...

java - Property 'service' is required when migrate from Spring 2 to Spring 4 -

this server context used work fine spring 2: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation=" http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="myservice" class = "com.example.service.myservicefactory" factory-method="getinstance"/> <bean class="org.springframework.remoting.rmi.rmiserviceexporter"> <property name="servicename" value="myservice"/> <property name="service" ref="myservice"/> <property name="serviceinterface" value="com.example.service.myservice"/> <property name="registryport" value="1199"/> </bean> </beans> ho...

php - Making a search of course/teacher with Ajax and jQuery -

i have jquery ajax problem. i have select tag options of courses, select holds div id="course". have button id of "go" , empty div id of "courseinfo". need make when course number selected, teacher name in php file goes displayed on page. have ajax written, linked, wont work , no error when debug. $(document).ready(function(){ findcourse = function(){ var file = "course.php?course="+$("#course").val(); $.ajax({ type: "get", url: file, datatype : "text", success : function(response) { $("#courseinfo").html(response); } }); } clear = function(){ $("#courseinfo").html(""); }; $("#course").click(clear); $("#go").click(findcourse); }); form: <form action="" method="post"> <select name="course" id="course"> <option value="420-121">420-121</option> <op...

java - how to convert a String into a character array without .toCharArray instance method -

// have prompt user input string , store char [] array // know can use .tochararray instance method store string // character array. // not have use method, reference string input // char array got compiler error saying cannot convert string char // have done far import java.util.scanner; /** program prompts user input string , outputs entire string uppercase letters. */ public class stringuppercase { public static void main(string [] args) { string input; scanner keyboard = new scanner(system.in); system.out.println("please enter string " ); input = keyboard.nextline(); char[] name; } } here code snippet convert string char array , output in uppercase. public static void main(string[] args) { string inputstring; system.out.println("please enter string"); scanner sc = new scanner(system.in); inputstring = sc.nextline(); sc.close(); ...

javascript - Firefox: function hoisting error -

i used assume functions hoisted top of block of javascript code. for example, works: document.addeventlistener('something', dummy); function dummy(){ console.log('dummy'); } but doesn't work , throws referenceerror in firefox, works in chrome: if(document){ document.addeventlistener('something', dummy1); function dummy1(){ console.log('dummy'); } } fiddle code initially, assumed chrome throw error before tested, somehow works correctly. can explain why doesn't work in firefox? it appears has been issue quite while - here's reference 2011: http://statichtml.com/2011/spidermonkey-function-hoisting.html apparently firefox happily hoist function declarations outside of block, doesn't inside block. author of linked article argues (while unexpected) compliant ecma-262 spec , allows statements inside of block...as function declaration not statement. however, i'll note firefox happi...

php - Information not being entered into mysql database using PDO -

i have register page user enters name , email , send them activation email. working told need use pdo make more secure. right when click submit runs through without errors user not added database. here code: <? session_start(); include 'db.php'; $dbh = new pdo("mysql:host=$dbhost;dbname=$database_name", $dbusername, $dbpasswd); // define post fields simple variables $first_name = $_post['first_name']; $last_name = $_post['last_name']; $username = $_post['username']; $email_address = $_post['email_address']; $password = $_post['password']; $confirm_password = $_post['confirm_password']; $hash = password_hash($password, password_default); /* let's strip slashes in case user entered escaped characters. */ $first_name = stripslashes($first_name); $last_name = stripslashes($last_name); $username = stripslashes($username); $email_address = stripslashes($email_address); if((!$username) || (!$email_addre...

c# - Find textbox control in ASP dynamic table -

i dynamically creating table contains textbox. doing following code: foreach (datarow row in score_sheet.rows) // loop on rows. { int rowindex = score_sheet.rows.indexof(row); // not sure if need yet label label = new label(); textbox txt = new textbox(); txt.text = row["value"].tostring(); txt.id = row["risk"].tostring(); label.text = row["risk"].tostring() + " = "; rows = new tablerow(); cell = new tablecell(); cell.controls.add(label); cell2 = new tablecell(); cell2.controls.add(txt); rows.controls.add(cell); rows.controls.add(cell2); ssgrid.controls.add(rows); } this adding table webpage via code: <asp:table...

How to check the occurence of each words in the textfile and display the number of times C++ -

i have c++ issue. have text file store following data. wish simple program read data , print out frequent display of item , quantity of it. i not wish set array of fixed number of words search through file item entered text file not predetermined below structure of data in text file the fourth value quantity , second value item name text file: 1|bag|2|3|6|20apr2015 2|fruit|2.3|5|11.5|20aug2015 4|water|0.9|5|4.5|20jun2015 5|file|0.9|5|4.5|20jul2015 6|water|0.9|5|4.5|20nov2015 7|water|0.9|5|4.5|20may2015 8|bag|0.9|5|4.5|20jan2015 9|water|0.9|5|4.5|20feb2015 10|water|0.9|5|4.5|20jan2015 11|water|0.9|5|4.5|20dec2015 12|file|0.9|5|4.5|20oct2015 13|water|0.9|5|4.5|20sep2015 14|water|0.9|5|4.5|20sep2015 desired output: the frequent item water , 40 sold the least frequent item fruit , 5 sold here current coding void computeitem() { string itemid; float totalprice; string item[4] ={"water","bag","fruit",...

mysql - Insert into a table from two different tables -

here have 3 tables. sbs_users sbs_permissions sbs_user_permissions let's data of each table are: - sbs_users(table1) userid username 1 john 2 albert - sbs_permissions(table2) permissionid permission 1 create 2 edit - sbs_user_permissions(table3) upid(autoid) userid permissionid what wanna insert table3 data table2 last id in table1. so expected after insert is: - sbs_user_permissions(table3) upid(autoid) userid permissionid 1 2 1 2 2 2 thanks in advance if read correctly, want give permissions user max user id? if so, this: insert user_permissions select u.id, p.id users u cross join permissions p u.id = (select max(id) users); demo here

visual studio - template project in TFS -

i have "common" web template project in tfs. web project common layout , library framework used many other projects. every time work on new project, create branch "common" template. such structure, if there's new changes on common framework, can merge new changes "common" template. the problem face when have multiple projects open , try run project, run project first opened in vs. think due assemblyinfo.cs in project. tried change solution name , project name couldn't resolve issue. my vs version 2012 professional i still couldn't find suitable answer this. had around set virtual port on web project.

batch file - Why I cant redirect the output of PRINT to console? -

this: @echo ###########>printable.txt @print /d:con printable.txt 1>nul 2>nul always produces output console: ########### ♀ not matter how output redirected .piping more or findstr not help. is possible redirect print console? redirection works stdin, stdout, , stderr file streams. pipe works exclusively via stdout. you can direct print write console device, causing output appear on screen. not going through stdout or stderr, not good. print writes directly device, not stdout or stderr. don't think there way want.

python - Getting the current path from where a module is being called -

i have python module built myself , it's located in /usr/local/lib/python3.4/site-packages/my_module1 . in module have this: class class1(object); def __init__(self, file_name): self.file_name = file_name # how can full path of file_name? how full of file_name ? is, if it's file name without path, append current folder from module being called . otherwise, treat file name full path. # /users/me/my_test.py module1 import class1 c = class1('my_file1.txt') # should become /users/me/my_file1.txt c1 = class1('/some_other_path/my_file1.txt') # should become /some_other_path/my_file1.txt/users/me/my_file1.txt update: sorry that. mis-read question. need pass filename os.path.abspath() . example: import os filename = os.path.abspath(filename) to cater 2nd case ( which find quite weird ): import os if os.path.isabs(filenaem): filename os.path.join( os.path.join( filename, os.getcwd() )...

ios - Trying to draw multiple circles but both circles connect with a line -

i drew circle when try add circle line connects both circles. import uikit class skills: uiview { override func drawrect(rect: cgrect) { var startangle: float = float(2 * m_pi) var endangle: float = 0.0 var endangletwo: float = 2.0 // drawing code // set radius let strokewidth = 10.0 let radius = cgfloat((cgfloat(self.frame.size.width) - cgfloat(strokewidth)) / 20) // context var context = uigraphicsgetcurrentcontext() **// find middle of circle let center = cgpointmake(100, 200) let inside = cgpointmake(100,400)** // set stroke color cgcontextsetstrokecolorwithcolor(context, uicolor.whitecolor().cgcolor) // set line width cgcontextsetlinewidth(context, cgfloat(strokewidth)) // set fill color (if filling circle) cgcontextsetfillcolorwithcolor(context, uicolor.clearcolor().cgcolor) // rotate angles inputted ang...

python - Regression with lasagne: error -

i trying run regression lasagne/nolearn. having trouble finding documentation how (new deep learning in general). starting off simple network (one hidden layer) from lasagne import layers lasagne.nonlinearities import softmax lasagne.updates import nesterov_momentum nolearn.lasagne import neuralnet print(np.shape(x)) # (137, 43) print(np.shape(y)) # (137,) layers_s = [('input', layers.inputlayer), ('dense0', layers.denselayer), ('output', layers.denselayer)] net_s = neuralnet(layers=layers_s, input_shape=(none, num_features), dense0_num_units=43, output_num_units=1, output_nonlinearity=none, regression=true, update=nesterov_momentum, update_learning_rate=0.001, update_momentum=0.9, eval_size=0.2, verbose=1, max_epochs=100) net_s.fit(x, ...

c# - Display data from decimal to integer -

in database show column "value" 0.06 datatype decimal(18,2). how can display in textbox value value 6 not 0.06? i try change format {0} not successful. if used convert, how can convert it? <input type="text" runat="server" title="value" id="value" name="value"/> protected string r_value = string.empty; protected void page_load(object sender, eventargs e) { if (string.format("{0}",request.params["value"]) != null) r_value = string.format("{0}",request.params["value"]); if (!ispostback) { list_detail(); } } private void list_detail() { try { bizevalue biz = new bizevalue(); dataset ds = biz.spvalue(r_ven); if (ds.tables[0].rows.count > 0) { datarow row = ds.tables[0].rows[0]; value.value = string.format(...

delphi - Assigning properties using RTTI without knowing what type the property is -

i have object newobject unknown properties , want able assign values properties without knowing type property is. the best can far vctx := trtticontext.create; vtype := vctx.gettype(newobject.classtype); vprop in vtype.getproperties begin vpropvalue := 'test value'; val := tvalue.from<string>( vpropvalue); vprop.setvalue( newobject , val ); end; of course, assumes properties of type string how make more general? since don't provide information of value , can handle (in comments) post part find out property type , leave rest unless provide additional information. i leave other type kinds , give rough idea. if vprop.iswritable begin case vprop.propertytype.typekind of tkinteger: val := tvalue.from<integer>(...); tkfloat: val := tvalue.from<double>(...); tkustring: val := tvalue.from<string>(...); end; vprop.setvalue(newobject, val); end;

python - how to stream tweets for a particular time period in the past -

i using following python code tweets particular topic import sys tweepy import * import time import csv consumer_key = '' consumer_secret = '' oauth_token = '' oauth_token_secret = '' class listener(streamlistener): def on_data(self,data): try: savefile=open('tweetdb2.csv','a') savefile.write(data) savefile.write('\n') savefile.close() return true except baseexception e: print('failed ondata,',str(e)) time.sleep(60) def on_error(self,status): print(status) auth = oauthhandler(consumer_key,consumer_secret) auth.set_access_token(oauth_token,oauth_token_secret) twitterstream = stream(auth,listener()) twitterstream.filter(track=["ipl"]) how modify code tweets same topic different time period (say 2nd week of april,2015)? went through api parameters( https://dev.twitter.com/streaming/overview/r...

php - How to use OR & AND in WHERE clause in mysql -

i'm new mysql & have table @ presently i'm fetching data select * tablename name='$user' , date='$selecteddate' now want add 1 more column named status_id want select values i.e 1 or 2 i tried query select * tablename (name='ankit') , (date='2015-04-23') , (status_id='1' or status_id='2') but didn't work out. please help. well, need elements concerned or clause between parenthesis. they not "needed", way (you use precedence order of , / or), best way readability. and if status_id data type int, don't need ' ' around 1, , 2. select * tablename name='ankit' , date='2015-04-23' , (status_id=1 or status_id=2) by way, in case, may use in clause and status_id in (1, 2)

ios - "Access your photos" permission dialog showing up in wrong view -

i trying change user's profile picture in ios, in user can select picture gallery. when access gallery using uipickercontroller asks permission access photos; permission alertview pops on different view in app. how can allow access photos in app or solve pop issue? there no way programmatically force access photos. privacy issue!

java - Cast to inherited class from ArrayList of base class -

i have 2 classes , b , base class , b inherited a. class { int foo=10; } class b extends { int bar=100; } i declare arraylist of class , insert class , class b objects it. my issue when attempt class b object in arraylist of class , cast class b follows b foobar = (b)arraylistofclassa.get(indexofclassb). the value of bar in object b undefined. how value of object b arraylist of class ??? don't try typecast instances this. check type before calling method / field using getclass()== . if(myinstance.getclass()==b.class) //print myinstance.bar note : not design because breaking important thing generics introduced (and can see happens when that)

php - Increment columns in laravel -

is there way increment more 1 column in laravel? let's say: db::table('my_table') ->where('rowid', 1) ->increment('column1', 2) ->increment('column2', 10) ->increment('column3', 13) ->increment('column4', 5); but results to: call member function increment() on integer i want find efficient way using given functions laravel. thanks. suggestions do. there no existing function this. have use update() : db::table('my_table') ->where('rowid', 1) ->update([ 'column1' => db::raw('column1 + 2'), 'column2' => db::raw('column2 + 10'), 'column3' => db::raw('column3 + 13'), 'column4' => db::raw('column4 + 5'), ]);

javascript - Get response of multiple deferred objects in jquery -

below multiple ajax calls promises. $(window).load(function(){ $.when(getapimodemlist()).done(function(vendors){ var deferreds = calculateapibalances(vendors); $.when.apply($,deferreds).done(function(balance) { console.log(balance); console.log("all done"); }); }); function getapimodemlist(){ return $.getjson("url"); } function calculateapibalances(vendors) { var defer=[]; $.each(vendors,function(k,v){ defer.push($.getjson(someurl)); }); return defer; } }); function calculateapibalances() return me balance need sum total of balance . when print console.log(balance) doesnot provide me valid array of balance json. issue if 1 of ajax calls in calculateapibalances() fails doesnot prints done. should done in above code achieve this. but when print console.log(balance) doesnot provide me valid array of balance json. that's weird thing of $.when . doesn't provide array, calls callback multi...

How to get all the properties from ember.js controller? -

i want values controller set using set() method. for example : if this.controllerfor('application').set("one", "1"); this.controllerfor('application').set("two", "2"); this.controllerfor('application').set("three", "3"); this.controllerfor('application').set("four", "4"); so how can values directly. mean dont 1 one using get() method. you can use method getproperties , see example this.controllerfor('application').getproperties('one', 'two', 'three', 'four') reference: http://emberjs.com/api/classes/ember.controller.html#method_getproperties

c++ - MSVCP120.dll was not found -

i have windows vista 64-bit installed in virtualbox. when try run c++ program developed in visual studio 2013, error "this application has failed start because msvcp120.dll not found". installed c++ redistributable packages visual studio 2013 (both x86 , x64) still getting same error. have file "msvcp120.dll" in both windows\system32 , windows\syswow64. how fix this?

Running without the SUID sandbox! while running source code for Chrome -

i download chromium source code , compiled according instruction stated on website. when tried run binary file chrom in out/debug/chrom getting error [17144:17144:0423/112117:fatal:browser_main_loop.cc(169)] running without suid sandbox! see https://code.google.com/p/chromium/wiki/linuxsuidsandboxdevelopment more information on developing sandbox on. my chrome folder in /home/user/chromium/src .. solved this! when run out/debug/chrom , error comes can run $ out/debug/chrom --no-sandbox at least chrome work then!

java - Log4j not initialized when logger is called from a @PostConstruct -annotated method -

i'm using spring, log4j , slf4j. while trying log info @postconstruct -annotated method log4j complains not been yet initialized. when later on log class log4j works ok. private final static logger log = loggerfactory.getlogger(myclass.class); @postconstruct public void init() { log.info("initializing service"); } output : log4j:warn no appenders found logger (mypackage.myclass) log4j configuration a file-based one: log4j.rootlogger=info, console log4j.appender.console=org.apache.log4j.consoleappender log4j.appender.console.layout=org.apache.log4j.patternlayout log4j.appender.console.layout.conversionpattern=%d %-5p %c %x - %m%n the postconstruct methods called spring container right after dependency injection done, before init-methods. in post-construct class instance isn't initialised. suggest using initializingbean or init-method purpose.

datepicker - how to display two different date picker in android -

hi in below displaying 2 date picker 1 fromdate , date.but took 2 different methods calling.but using single function how display 2 different date picker selected date can 1 me expected output: for example fromdate:2015-04-01 todate:2015-04-23 java public class general_report extends activity implements onclicklistener{ edittext fromdate,todate; datepickerdialog fromdatepickerdialog; datepickerdialog todatepickerdialog; simpledateformat dateformatter; button report; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.general_report); report=(button)findviewbyid(r.id.report); report.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { string selectedfromdate=fromdate.gettext().tostring(); string selectedtodate=todate.gettext().tostring(); intent = new i...

angularjs - Angular $http changing url on Rails Devise -

this first ever stack overflow question because google sorts me out. can't seem find anything/anyone online replicating issue. i'm using angular devise module , when attempt login following url test.aam.tunnel.logicsaas-development.com:3000/users/sign_in.json $http or devise changes to http://undefined:undefinedtest.aam.tunnel.logicsaas-development.com:3000/users/sign_in.json here config code: authinterceptprovider.interceptauth(true); authprovider.loginpath('test.aam.tunnel.logicsaas-development.com:3000/users/sign_in.json'); authprovider.loginmethod('post'); authprovider.resourcename('users'); and login call: var credentials = { email: 'user@domain.com', password: 'password1' }; auth.login(credentials).then(function(user) { console.log(user); // => {id: 1, ect: '...'} }, function(error) { console.log(error) // authentication failed... }); i dug devise , im 99% sure happening $http....

linux - Is there any way to reduce the size of the embedded font documents in libreoffice? -

my requirement want display local language in documents. enabled embedfont option in libreoffice writer . after enabling option size getting increased 2mb . want reduce size. there anyway reduce size of document.please give me idea.thanks in advance. the legal way use embed font sub-set. but as know libreoffice not support feature.

c - Is standard behavior relate to gcc version? -

will of standard c library behavior affected gcc version? 1 example interested in strncpy() other examples interesting too. will of standard c library behavior affected gcc version? yes, depends. it's quite broad question. there differences in gcc supports depending on version of gcc using. gcc has many extensions not in standard c (hence not portable if use extensions). disable of them -std=xx -pedantic-errors flag. assuming have gcc version supports standard c features(whatever standard aim for), additional differences between standard c vs. posix c vs. gnu c vs. linux specific extensions documented in manual, consult determine potential differences or extensions. strncpy, there's no difference in behaviour between standard c , gnu c.

c - cudaMalloc runtime error -

Image
i have problem executing following code on host , not sure going wrong. understanding need allocate enough memory store contents of textdata textlength in size on device, malloc sizeof(char) * textlength should give me enough space, use cudamemcpy copy of values textdata allocated space on device. exception reads "access violation reading location 0x000000000501f80400" memory address of cutextarray on device. texture<char, cudatexturetype1d, cudareadmodeelementtype> textdataref; int textlength = 10000000 cudaarray *cutextarray; checkcudaerrors (cudamalloc(&cutextarray, sizeof(char)*textlength)); checkcudaerrors(cudamemcpy(cutextarray, textdata, sizeof(char)*textlength, cudamemcpyhosttodevice)); checkcudaerrors(cudabindtexturetoarray(textdataref, cutextarray, textdataref.channeldesc)); i cannot use cudamallocarray data big buffer - maximum of 8192 bytes exception here seems crash @ binding texture array snippet of c...

Create a Eclipse Plug-in in Java 8 -

i work on plug-in want create in java 8. see eclipse luna requires java 7. create difficulties? thank's in advance eclipse luna requires java 7 minimum. there no problem using java 8 plugins.

indexing - Apparent Race condition when deleting and recreating a elasticsearch index via the Java API -

i getting error - index exists when creating index deleted. below simple test created replicate behaviour: client elasticsearchclient = elasticsearchlocalservice.getclient(); if (elasticsearchclient.admin().indices().exists(new indicesexistsrequest(indexname)).get().isexists()) elasticsearchclient.admin().indices().delete(new deleteindexrequest(indexname)).get(); elasticsearchclient.admin().indices().exists(new indicesexistsrequest(indexname)).get().isexists();//returns false elasticsearchclient.admin().indices().create(new createindexrequest(indexname)).get(); even though second call check if index exists returns false still error, i've tried refresh index think affects data. expected .get on delete block until finished. thanks !

google chrome - save all the HTTP objects including header info in chromium -

i have downloaded source code , compiled on linux machine(as instructed on website). want intercept on point can save/copy(in other directory) http/or whatever objects browser receives internet. i don't want use network tools because of encryption , other issues. thinking use open source browser , intercepting it. so should chromium code job done. thanks

jquery - How to target a Bootstrap modal using Typeahead JS in an Angular controller -

im using bootstrap, typeahead js , angular. cant target bootstrap modal typeahead template in angular controller. doesnt recognize angular expression in footer has target modal in html. has template doesnt recognize angular expressions. so, target bs modal footer in template. there proper solution make work? see code: <div id="something{{some.id}}" class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mysmallmodallabel" aria-hidden="true"> <div class="modal-dialog modal-sm"> <div class="modal-content"> <div class="modal-header"> header here... </div> <div class="modal-body"> content here... </div> <div class="modal-footer"> ...

Cannot start Android Studio. Android Studio stuck at the splash screen -

i not able start android studio. have set java path in environment variables , android studio latest version. have tried install , run administrator no help. please me... open file android studio setup directory/bin/idea.properties add disable.android.first.run=true tail restart as

javascript - How to include proj4js into your project -

i don't understand how include proj4.js project. following documentation should add <script src="lib/proj4js-combined.js"></script> in code. if add .html file .js file (in use proj4js functions) not see it. , can not add .js file .js file , not .html file.. how did it? thanks if load them in order (in html file): <html> <head> <script src="lib/proj4js-combined.js"></script> <script src="myfolder/js-file-with-proj4js-functions.js"></script> </head> <body> ... then js file able see needs library.

angularjs - How to return result of function in HTML at Angular? -

how return result in html template fnuction angular js? html: <div>{{getname({{type}})}}</div> angular js: $scope.getname = function (type){ return 'bob'; } i need bob in div element remove second pair of curly braces. {{getname(type)}} sufficient.

How to pass multiple (non-cell) arguments to a function in Octave's parcellfun( )? -

is there way pass additional numeric arguments function (or handle) inside parcellfun() ? for example, if have cell array images , want apply medfilt2() them, i'll write like: images = parcellfun( nproc, @medfilt2, images, 'uniformoutput', false ); what is, if @ all, way pass additional arguments medfilt2 , in case, let's [7 7] ? octave's has say: [o1, o2, ...] = parcellfun (nproc, fun, a1, a2, ...) .. a1, a2 etc. should cell arrays of equal size. gnu octave 3.8.1, in case helps. you want same parameter inputs, create anonmyous function: medfilt2wparam=@(a)medfilt2(a, [7 7]) now use code have function medfilt2wparam

sql server 2008 - ROUND TSQL - .5 not rounding up -

in select statement have following case statement need round 0 decimal places return int: select reportingdate , portfolioid , portfolionme , '16' [rank] , 'average credit rating' rating , round(sum((percentage * case when wt.issuetype1 in ('050','110') 15.5 else xref.internal_value2 end ))/sum(percentage),0) [weight] @worktablesa wt left outer join dp_crossreference xref on xref.internal_value = wt.rating , xref.codeset_type_id = 10013 , xref.originator_id = 'kurtosysextract' group wt.reportingdate , wt.portfolioid , wt.portfolionme order wt.reportingdate , wt.portfolioid there 1 particular result returned isn...

Execute Shell script/command from MySQL Trigger/Stored Procedure -

i'm writing main assignment on last semester @ study (it-engineering networking) , working mysql. my question is: possible execute shell script/command within mysql trigger/procedure? or can done case statement? i've been searching around internet , read it's inadvisable it. need script check table in database alerts , warn people if there any. if there anyway else done, i'm open ideas. input appreciated :) you can read blog triggering shell script mysql: https://patternbuffer.wordpress.com/2012/09/14/triggering-shell-script-from-mysql/ i think requirement write python/php/perl script connect mysql db , query alert table alert , accordingly show warning message on screen or send email/sms warning.

Reducing the size of an array by averaging points within the array (IDL) -

while sure there answer, , question low-level (but it's easy things trip up), main issue trying word question. say have following arrays: time=[0,1,2,3,4,5,6,7,8,9,10,11] ;in seconds data=[0,1,2,3,4,5,6,7,8,9,10,11] the 'time' array in bins of '1s', instead array in bins of '2s' data mean: time=[0,2,4,6,8,10] ;in seconds data=[0.5,2.5,4.5,6.5,8.5,10.5] is there (and sure there is) idl function implement in idl? actual data array is: data double = array[15286473] so rather use existing, efficient, solution unnecessarily creating own. cheers, paul nb: can change time array want interpolating data (interpol) idl> x=[0,1,2,3,4,5,6,7,8,9,10] idl> x_new=interpol(x,(n_elements(x)/2)+1.) idl> print, x_new 0.00000 2.00000 4.00000 6.00000 8.00000 10.0000 the issue data array i think need rebin : http://www.exelisvis.com/docs/rebin.html congrid provides...

c# - VSTO Microsoft Office Outlook 2013 Addins keep disabling Ribbon -

i developed application using c# outlook ribbon addins. working fine, keep disabling when outlook start. is add-in listed in disabled items list? microsoft office applications can disable add-ins behave unexpectedly. if application not load add-in, application might have hard disabled or soft disabled add-in. hard disabling can occur when add-in causes application close unexpectedly. might occur on development computer if stop debugger while startup event handler in add-in executing. soft disabling can occur when add-in produces error not cause application unexpectedly close. example, application might soft disable add-in if throws unhandled exception while startup event handler executing. when re-enable soft-disabled add-in, application attempts load add-in. if problem caused application soft disable add-in has not been fixed, application soft disable add-in again. see how to: re-enable add-in has been disabled more information. also outlook 2013 monitors ...

ios - API not returning valid response with raw data. but working well on postman -

Image
i trying json response server receive error have pasted below.however api call working fine on postman.please suggest solution doing wrong here optional(error domain=nsurlerrordomain code=-1012 "the operation couldn’t completed. (nsurlerrordomain error -1012.)" userinfo=0x7f9050e1f750 {nserrorfailingurlstringkey= https://rainforestcloud.com:9445/cgi-bin/post_manager , nsunderlyingerror=0x7f9050fe4eb0 "the operation couldn’t completed. (kcferrordomaincfnetwork error -1012.)", nserrorfailingurlkey= https://rainforestcloud.com:9445/cgi-bin/post_manager }) here snippet of code var therequest : nsmutableurlrequest = nsmutableurlrequest(url: nsurl(string: base_url)!) therequest.httpmethod = "post" therequest.setvalue("text/html", forhttpheaderfield: "content-type") therequest.addvalue("cloud-id", forhttpheaderfield: "001226") therequest.addvalue("user", forhttpheaderfield: "joh...

compilation - How to change flags of a compiler in Xcode 6.3? -

i'd change compilers options (flags) of project based on "command line tool" project template xcode 6.3. basically, i'd remove -lcurses flag (which added during compilation) when project based on "command line tool" project template. i can't find correct path compiler's settings in xcode 6.3. unfortunatelly sites i've browsed previous version of xcode , seems path has changed since then.

python - What is the url for the browser based interactive console for live appengine project? -

i have live appengine application (myapp.appspot.com). access (python) terminal behaviour within browser window. recall showing me functionality cannot seem find documentation on it. functionality looked similar interactive console available in local development environment. does know url @ can access tool? you have add handler admin application: - url: /admin.* script: google.appengine.ext.admin.application login: admin then can access interactive console @ /admin/interactive . its possible appstats, have add appstats_shell_ok = true in appengine_config.py .

c# - Inconsistent accessibility less accessible -

i've searched answers on similar errors, haven't been able find any. know how fix error (make public - don't want do), don't understand why not allowed. anyway - i'm getting inconsistent accessibility: property type 'e7xlibrary.base.multisegmentbase' less accessible property 'e7xlibrary.e7xgroupbase.groupsegment' my multisegmentbase class declared internal class (and segmentbase class): internal class multisegmentbase : segmentbase i’m using multisegmentbase instance protected abstract property in public e7xgroupbase class: public abstract class e7xgroupbase { internal abstract uint64 length { get; } protected abstract multisegmentbase groupsegment { get; } internal virtual void wrap(binarywriter writer) { groupsegment.length = this.length; groupsegment.wrap(writer); } } and lastly have devided public class e7xsessiongroup class implements abstract e7xgroupbase, this public class e7xsess...

vb.net - How to use an external config .ini file in VB .Net? -

i have program in vb.net uses winsock. want make external config in .ini file. program works when i'm running it, when want lister port error. here function reads .ini file: public function getsettingitem(byval file string, byval identifier string) string dim s new io.streamreader(file) : dim result string = "" while (s.peek <> -1) dim line string = s.readline if line.tolower.startswith(identifier.tolower & ":") result = line.substring(identifier.length + 2) end if loop return result end function this winsock listen port: private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click axwinsock1.localport = getsettingitem("d:\mainconfig.ini", "port") axwinsock1.listen() end sub error an unhandled exception of type 'system.invalidcastexception' occurred in microsoft.visualbasic.dll additional information: convers...