Posts

Showing posts from August, 2010

javascript - Parse.com Save object as Date type -

i trying save object date data type, saves string. read parse.com needs format in iso8601 , make sure got correct used moment.js library ensure be. here current code: for (var = 0; < data[i].body.und.length; i++) { article = new articles(), content = data[i]; article.set("body", content.body.und[0].value); article.set("vid", content.vid); article.set("title", content.title); var epochtime = content.created; var dateobject = moment.unix(content.created).format(); article.set("datecreated", dateobject); articles.push(article); }

ios - Error with URLsession delegate function -

i trying make ssl connection urlsession delegate , error message get: objective-c method 'urlsession:didreceivechallenge:completionhandler:' provided method 'urlsession( :didreceivechallenge:completionhandler:)' conflicts optional requirement method 'urlsession( :didreceivechallenge:completionhandler:)' in protocol 'nsurlsessiondelegate' func urlsession(session: nsurlsession, didreceivechallenge challenge: nsurlauthenticationchallenge, completionhandler: (nsurlsessionauthchallengedisposition, nsurlcredential!) -> void) { let servertrust: sectrustref = challenge.protectionspace.servertrust! let servercert: seccertificateref = sectrustgetcertificateatindex(servertrust, 0).takeunretainedvalue() let serverkey: nsdata = seccertificatecopydata(servercert).takeretainedvalue() let bundle: nsbundle = nsbundle.mainbundle() let mainbun = bundle.pathforresource("ca", oftype: ...

java - Spring security exceptions -

i creating first web-app spring security. save database user login, name, last name, password - login , password supposed used login. when added login controller , spring security got errors. severe: exception while loading app : java.lang.illegalstateexception: containerbase.addchild: start: org.apache.catalina.lifecycleexception: org.springframework.beans.factory.beancreationexception: error creating bean name 'org.springframework.security.filterchains': cannot resolve reference bean 'org.springframework.security.web.defaultsecurityfilterchain#0' while setting bean property 'sourcelist' key [0]; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'org.springframework.security.web.defaultsecurityfilterchain#0': cannot resolve reference bean 'org.springframework.security.web.authentication.usernamepasswordauthenticationfilter#0' while setting constructor argument key [2]; nested exception o...

sql - Querying data by joining two tables in two database on different servers -

there 2 tables in 2 different databases on different servers, need join them make few queries. options have? should do? you'll need use sp_addlinkedserver create server link. see reference documentation usage. once server link established, you'll construct query normal, prefixing database name other server. i.e: -- db1 select * [mydatabaseondb1].[dbo].[mytable] tab1 inner join [db2].[mydatabaseondb2].[dbo].[myothertable] tab2 on tab1.id = tab2.id once link established, can use openquery execute sql statement on remote server , transfer data you. can bit faster, , let remote server optimize query. if cache data in temporary (or in-memory) table on db1 in example above, you'll able query joining standard table. example: -- fetch data other database server select * #mytemptable openquery([db2], 'select * [mydatabaseondb2].[dbo].[myothertable]') -- can join temp table see data select * [mydatabaseondb1].[dbo].[mytable] tab1 ...

java - Array or ArrayList -

i familiar using arrays came across arraylist , wondering if typically use arraylist more regular array? for reference arraylist looks : arraylist<dog> mydogarraylist = new arraylist<dog>(); regular array: string [] dog = new string(type) arraylist s (or, in general, collections) intended heavy read , write operation without thinking capacity, extension , forth (in first place). more comfortable call arraylist#add creating new array size oldarray.length + 1 , doing system.arraycopy , adding element. there lots of handy methods ( indexof , remove , sublist ) leverage complexity of use in comparison arrays. if take @ collections class, you'll find lot of convenience methods shuffle or reverse . the use of list in general more common arrays, except you're heading performance.

configuring web service from java program -

i want build simple java web application wish change configuration of web services port number , protocol etc. start , stop them java program only. is possible ? as far know think changing port requires changing tomcat port , restart . possible achieve using java application. also how can service work on soap , rest per user's wish using java application. you can start apache cxf . simple understand , less configuration can make webservice up. for controlling tomcat start , stop of server, see this

function - Simple Logical Error in Python -

lines 12 , 13 of code not affecting program. current output: hi 10 hi 10 hola 10 desired output: hi 10 hi 6 hola 10 the second number in right column of csv output should changed 6, not 10 (due lines 12 , 13) why these lines not having affect? thanks or ideas. # -*- coding: utf-8 -*- import csv levels = [["1"], ["2"], ["3"]] def column1logic(self, level, greeting): self.column1 = "logic worked" if greeting == ["hola"]: self.column1 = ["poop"] else: self.column1 = self.greeting def column2logic(self, level, greeting): # budget self.column2 = 10 if level == [2]: self.column2 = self.column2 * .6 class row(object): column1 = "name" column2 = "budget" greeting = "oh" def __init__(self, level, greeting): self.level = level self.greeting = greeting def rowentry(self, level, gree...

asp.net - C#: Changing code from Session to ViewState causing page refresh -

i have page contain usercontrols. theses uc have contents visible or not depending on click. page using sessions retain data database, this: private viewpersoncollection collection { { if (session["viewpersoncollection.test1"] == null) session["viewpersoncollection.test1"] = new viewpersoncollection (); return (viewpersoncollection )session["viewpersoncollection.test1"]; } set { session["viewpersoncollection.test1"] = value; } } since having problems session when clients using different tabs @ same browser, changed view state, this: private viewpersoncollection collection { { if (viewstate["viewpersoncollection.test1"] == null) viewstate["viewpersoncollection.test1"] = new viewpersoncollection (); return (viewpersoncollection )viewstate["viewpersoncollection.test1"]; ...

How to initialize a pointer to a structure in C++? -

here defined structure struct structure in class a . class b nested in class a . class { public: struct structure // structure need { std::vector <std::vector <float>> input; std::vector <int> output; float ft; b* bb; }; private: b b; structure* pstruct; }; now want initialize pointer pstruct before use it. example, use pstruct->output.push_back() . for example can initialize pointer in default constructor of class. like class b {}; class { public: a() : b(), pstruct( new structure() ) { pstruct->bb = &b; } struct structure // structure need { std::vector <std::vector <float>> input; std::vector <int> ...

ruby on rails - How to reduce hitting db multiple -

lets assume have hundred thousand users simple example, user = user.where(id: 1..10000) user load (30.8ms) select `users`.* `users` (`users`.`id` between 1 , 10000) in here, want slice more this, user.where(id: 100..1000) user load (2.9ms) select `users`.* `users` (`users`.`id` between 1 , 10000) , (`users`.`id` between 100 , 1000) why active record hitting db twice? has result has bigger data. why have hit db, not reuse , slice activerecord::relation? is there solution this? activerecord keeps track of queries , able cache duplicate requests, in case it's not immediate library understand second 1 subset of first. moreover, there several reasons why generic library such activerecord may not want implement caching logic one. caching large data set in large application may result several mb of memory, , processes may reach memory limit of machine because garbage collector not able recollect memory. long story short, it's bad idea implement such f...

openssl - Error in SSLv2/SSLv3 read client hello -

some background: i trying setup reverse proxy internal business users site validation when external route down. able setup multiple routes corresponding virtualhosts entries in httpd.conf port 80 : anonymous user. afraid stuck @ ssl route , unable make progress. have been multiple forums unable find response assists me in moving further. server details: apache version: apache/2.2.29 (unix) linux version: $ cat /etc/*-release enterprise linux enterprise linux server release 5.8 (carthage) oracle linux server release 5.8 red hat enterprise linux server release 5.8 (tikanga) problem: when try access on ssl (*:443) empty response on 3 browsers (ie/chrome/firefox). note: generated self signed certificate following instructions @ how create , install apache self signed certificate . troubleshooting error log [wed jul 08 23:16:06 2015] [notice] digest: generating secret digest authentication ... [wed jul 08 23:16:06 2015] [notice] digest: done [wed jul 08 23:16:06 2015] [...

c++ - Can you prevent inherited private members being called through the parent at compile time? -

if have feature rich class, possibly 1 not own/control, case want add functionality deriving makes sense. occasionally want subtract well, disallow part of base interface. common idiom have seen derive , make member functions private , not implement them. follows: class base { public: virtual void foo() {} void goo() { this->foo(); } }; class derived : public base { private: void foo(); }; someplace else: base * b= new derived; and yet place: b->foo(); // way prevent @ compile time? b->goo(); // or this? it seems if compilation doesn't know derived, best can not implement , have fail @ runtime. the issue arises when have library, can't change, takes pointer base, , can implement of methods, not all. part of library useful, run risk of core dumping if don't know @ compile time functions call what. to make more difficult, others may inherit class , want use library, , may add of functions didn't. is there way? in c++11? in c++...

javascript - Angular directive does not load -

i'm going crazy. i'm trying implement directives in angular app cant simple template show. if me spot problem soo grateful! (i'm new angular, if cans e mistakes or tips structure... t'm glad pointers) sorry massive amounts of code. heres esential parts of html: <!doctype html> <html ng-app='app'> <head> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css"> <link rel="stylesheet" href="stylesheets/stylesheet.css"> <link href="libs/angular-xeditable-0.1.8/css/xeditable.css" rel="stylesheet"> <title>kaching</title> </head> <body> <div id='wrapper' class='container' ng-controller='itemcontroller'> ...

Is there a way to @import a LESS stylesheet, based on URL? -

in main less stylesheet @import less files, import helper file indicates things breakpoints, etcout ... //@import url(reset.less); @import url(variables.less); @import url(mixins.less); @import url(base.less); ... etc ... @import url(mediaqueries.less); //@import url(indicator.less); ... note last @import . is there way import last file when base url of local, don't have keep commenting out import rule before compiling?

html - Bootstrap 3 sign glyphicon with white circle background -

problem is there way make bootstrap 3.2 sign glyph have white background ? being displayed on coloured background. i've got example on bootply has white trim annoying. css .glyph-white-background { background-color:#ffffff; border-radius: 50%; } i had play bootply , there may better ways of doing sorted placing inner span inside glyphicon element , positioning border not overlap parents. <div class="header"> <span class="glyphicon glyphicon-exclamation-sign glyph-background"> <span class="inner"></span> </span> </div> the css positions inner provide red background icon only. .header { background-color:#3aa3cb; font-size: x-large; } .glyph-background { position:relative; border-radius:50%; color:#fff; z-index:2; } .inner { position:absolute; top:2px; left:2px; right:2px; bottom:2px; border-radius:50%; background-color:red; ...

ios - Repostioning a UITableView -

i have view controller with sub view(half main view size) table view(half main view size) navigation bar button on click of button want sub view hide , table view show full main view size....it working fine below code, not first time. first time when click bar button hides sub view , resizes table view not show result on screen(works rest time). if incase scroll tableview before clicking navigation bar first time works fines...i think has table view loading cant make out code if(ismapvisible==yes) { [mapview sethidden:yes]; [tblview setframe:cgrectmake(self.view.frame.origin.x, self.view.frame.origin.y+self.navigationcontroller.navigationbar.frame.size.height+[uiapplication sharedapplication].statusbarframe.size.height, self.view.frame.size.width, self.view.frame.size.height-self.navigationcontroller.navigationbar.frame.size.height-[uiapplication sharedapplication...

sas ods - Is it possible to import a PNG file into SAS to include in RTF output? -

i have png files created outside of sas include in rtf file output sas using ods. possible use sas this? internet searches turning lot of irrelevant results. ods rtf: basics , beyond , relevant. here's example of doing in body text not using title. ods rtf file="c:\temp\test.rtf" startpage=never; ods escapechar='^'; proc print data=sashelp.class; run; ods text='^s={preimage="c:\temp\sgplot.jpeg" just=c}'; proc print data=sashelp.class; run; ods rtf close; that's using random sgplot had laying around, of course can use whatever prefer. added startpage=never have put things on same page - of course that's optional (otherwise it'll put image on own page in example). the important thing ods text (which puts text, normally), ods escapechar (which sets ^ escape character), , ^s={ } how insert styles , similar things in rtf (and other destinations). use preimage means put image before next bit (the text, blank h...

wpf - Clickonce Application file has reference to wrong deployment codebase path -

i using msbuild deploy clickonce wpf app. after deployment, application clickonce file(myapplication.application) has following node <deployment install="true" mapfileextensions="true" minimumrequiredversion="4.9.25.0" co.v1:createdesktopshortcut="true"> <subscription> <update> <beforeapplicationstartup /> </update> </subscription> <deploymentprovider codebase="file://myapppath/myapplication.application" /> </deployment> the code base value taken csproj file's publishurl node. however, supply value when publish project using msbuild via command line script. so <msbuild projects="ltl.sol.workflowdesigner.csproj" targets="publish" properties="publishdir=$(publishdir);publishurl=http://myapp/;installurl=$(installurl)"></msbuild> the path supply ignored, , clickonce picks publish url csproj file. ideas ...

best buy api - Get BestBuy seller's orders using Commerce API -

how can fetch order details of particular seller using bestbuy api? read documentation on https://developer.bestbuy.com/ seems there ain't related order management using api. commerce api https://developer.bestbuy.com/documentation/commerce-api basic commerce api functionality look product availability, delivery dates, shipping costs prior order submission create orders including store pick up, ship home , home delivery look order information modify/cancel order where documentation order , modification? does bestbuy allows fetching/updating order information using api? the commerce api requires more specific access regular best buy public apis. need apply specific commerce api key , become partner have access commerce api. if not yet partner, please send email developer@bestbuy.com request invite. further documentation can found once have access partner. thank you.

mysql - how to join tables and 2 select together -

i have following 2 queries, how can join them together? query1: select product_name, count(product_name) count_product_name ps_order_detail id_shop = 1 group product_name order count_product_name desc limit 5 query2: select count(*) count, concat(decade, '-', decade + 9) year (select floor(year(`birthday`) / 10) * 10 decade ps_customer) c group decade; the first query top 5 product name ordered most. the second query customer birthday year , group them every ten years. i want know age group order top 5 product. result should be product name, years, count producta 1990-2009 100 producta 2000-2019 20 productb 1980-1999 20 productb 1990-2009 25 productb 2000-2019 20 ... i have third table have connection. create table ps_orders( id_customer, id_order ); create table ps_customer( id_customer, birthday ); create table ps_order_detail( id_order, product_name ); i not sure how put them together, can input product name 1 one years. select c...

I have build a simple android app. In my activity most of the buttons work but others don't -

this code given below java code 1 of activity. activity have used button. problem buttons condition t works fine after them u z doesn't work although code same buttons. needs help. package irtiza.alphabets; import android.app.activity; import android.content.context; import android.content.intent; import android.media.audiomanager; import android.speech.tts.texttospeech; import android.os.bundle; import android.view.view; import android.widget.button; import android.widget.imageview; import java.util.locale; import java.util.random; public class alphabet_meaning extends activity implements view.onclicklistener { // voices string alphabet_meaning_voices = null; texttospeech tts; ///// @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_alphabet_meaning); // text voice button voice1 = (button) findviewbyid(r.id.b_1); voice1.s...

sql server 2008 - Update Across Tables -

i need set values in database , can't work. (i'm using ssms 2008 r2) the tables involved dbo.scales , dbo.posscore . dbo.scales contains 4 columns: grade (varchar) upper bound (int) lower bound (int) award (varchar) dbo.posscore has 2 columns: possible score (int) grade (varchar) i need fill dbo.posscore table appropriate grade according bounds given in dbo.scales table. it best if referential i.e. if change boundaries table adjusts accordingly. how should go this? you have 2 options if want values in posscore change when alter values in scales : either create trigger on scales (re-)creates posscore table whenever needed (or updates it), or use view changes dynamically. unless amount of data needs change prohibitively large , recalculating posscore values takes long view should best option. one way create view use suitable table number range covers upper , lower bounds. fortunately sql server has system table can used purpose (...

vb.net - Sending And Receiving Messages To/from Command Prompt -

i'm using vb 2010. problem is: i can send , display sent command in textbox without problem when try use .exe in cmd can't display in textbox source code is: private results string 'the "delegate" used correct threading issue (can't update control directly in vb.net 08/10), , invokes needed text update. private delegate sub delupdate() private finished new delupdate(addressof updatetext) private sub updatetext() textbox2.text = results end sub private sub form1_load(byval sender system.object, byval e system.eventargs) handles mybase.load end sub private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click dim cmdthread new threading.thread(addressof cmdautomate) cmdthread.start() end sub private sub cmdautomate() dim myprocess new process dim startinfo new system.diagnostics.processstartinfo 'starts cmd prompt ...