Posts

Showing posts from February, 2015

java - Why assert(false) give me a green bar when I perform this simple unit test method? -

into junit test cla have extremelly simple method: public void stupidtest() { assert(false); } the strange thing performing method obtain green bar , not red 1 expected (i think assert(true) have give me green bar , assert(false) red bar). why? missing? assert java keyword: junit doesn't care (and considered jvm if run -ea option). if want run junit test, should use asserttrue(false); junit method. give red bar.

java - Printing Inet4Address error -

i have little problem printing inet4address variable. i got 'the operator + undefined argument type(s) string, void' exception. i show part class: public class command{ private inet4address a; public inet4address geta(){ return a; } public void showconf(){ system.out.println("interface a: ip: " + geta().gethostaddress()); // there problem } } any simple solution? the geta(){ hade null return, try create constructor , initialize inet4address in solve problem: public class command{ private string url = "google.com"; private inet4address = null; public command() { super(); try { = (inet4address) inet4address.getbyname(url); } catch (unknownhostexception e) { // todo auto-generated catch block e.printstacktrace(); } } public static void main(string[] args) { new command().showconf(); } public inet4address geta(){ return a; } public void showconf(){

python - peewee mysql SSL: CERTIFICATE_VERIFY_FAILED -

python 3.4.3, pymysql 0.6.7 , 0.7.1, mysql 5.5.23 , 5.5.4x can't connect mysql ssl option. mysql workbench , mysql-client secure connection works fine. have tested on 2 mysql servers on debian , windows here code , explanations make certs openssl genrsa 2048 > ca-key.pem; \ openssl req -sha1 -new -x509 -nodes -days 3650 -key ca-key.pem > ca-cert.pem; \ openssl req -sha1 -newkey rsa:2048 -days 730 -nodes -keyout server-key.pem > server-req.pem; \ openssl x509 -sha1 -req -in server-req.pem -days 730 -ca ca-cert.pem -cakey ca-key.pem -set_serial 01 > server-cert.pem; \ openssl rsa -in server-key.pem -out server-key.pem; \ openssl req -sha1 -newkey rsa:2048 -days 730 -nodes -keyout client-key.pem > client-req.pem; \ openssl x509 -sha1 -req -in client-req.pem -days 730 -ca ca-cert.pem -cakey ca-key.pem -set_serial 01 > client-cert.pem; \ openssl rsa -in client-key.pem -out client-key.pem; user create create database dbname; grant privileges on dbname.* &

ios - character is not moving in scenekit -

hey have imported character animation in xcode , want move touch in scenekit let suppose point point b . not moving have following code. don,t know why not working please help....thanks //character imported blender var scene = scnscene(named: "art.scnassets/hero.dae")! // touches movement override func touchesbegan(touches: set<uitouch>, withevent event: uievent?) { var taps = event!.alltouches() touchcount = taps?.count } override func touchesended(touches: set<uitouch>, withevent event: uievent?) { touchcount = 0 } func positioncamerawithhero() { let hero = heronode.presentationnode var heroposition = hero.position let cameradamping:float = 0.3 var targetposition = scnvector3make(heroposition.x, 30.0, heroposition.z + 20.0) var cameraposition = camera.position var cameraxpos = cameraposition.x * (1.0 - cameradamping) + targetposition.x * cameradamping var cameraypos = cameraposition.y * (1.0 - cameradamping) + t

c++ - How can Boost.Asio create a buffer object of size equal to the size of the array? -

consider following lines (boost/c++): char d1[128]; size_t bytes_transferred = sock.receive(boost::asio::buffer(d1)); the boost.asio documentation states buffer of size 128 created. but how can boost determine size of array? i've read several questions, answer size of array cannot determined in c++. there template specialization arrays size known @ compile time http://www.boost.org/doc/libs/1_60_0/doc/html/boost_asio/reference/buffer/overload7.html template< typename podtype, std::size_t n> mutable_buffers_1 buffer( podtype (&data)[n]); in c++ 'char[5]', 'char[128]' , 'char*' different types compiler can take advantage of http://www.cplusplus.com/faq/sequences/arrays/sizeof-array/#cpp

javascript - ReactJS: drag and drop between multiple lists -

i'm newbie in reactjs. i'm having component similar this: <section/> <lesson/> <lesson/> <lesson/> <section/> <lesson/> <lesson/> <section/> <lesson/> <lesson/> <lesson/> how can drag , drop lesson among these sections? found library this: https://github.com/bevacqua/react-dragula , i'm little bit confused of ref section reactdom i looked @ dragula example. using react's feature called ref callback attribute . from documentation: react supports special attribute can attach component. ref attribute can callback function, , callback executed after component mounted. referenced component passed in parameter, , callback function may use component immediately, or save reference future use (or both).

sql server - Cannot find the object "QueryNotificationErrorsQueue" because it does not exist or you do not have permissions -

Image
i using sqldependecy signalr push notifications client browser when there database changes, followed this , this post , works fine in local sqlexpress version 11.0 local connection string , have kind of permissions problem when connect remote database hosted in godaddy production connection string working local connectionstring <!--<add name="notifyconnection" providername="system.data.sqlclient" connectionstring= "data source=.\sqlexpress;initial catalog=testdb;integrated security=sspi;" />--> production connectionstring <add name="notifyconnection" connectionstring="server=000.00.00.000;database=testdb; user id=username;password=yourpassword;" providername="system.data.sqlclient" /> get data method public ienumerable<order> getdata() { using (var connection = new sqlconnection(configurationmanager.connectionstrings ["notifyconnection"].connectionstring)) { using (

Java Keystore is giving performance issue? -

this question has answer here: java keystore.getkey() slow while key store size increase 2 answers we have developed application encrypt/decrypt request/response from/to server. doing performance testing of encryption/decryption application have observed encryption/decryption process taking time, while many threads doing @ same time. identify issue, have logged every methods part of encryption/decryption process. logger have found key fetching process taking 70-80% of time overall time of process. we have used aes algorithm encryption/decryption aes key stored in key store unique id. before encryption/decryption process, fetch aes key stored against unique id key store & perform encryption/decryption. performance getting worse when key store size getting increased. on further analysis, have found key store internally using hashtable. giving performance

c++ - deleting 2D Linked List array, How to? -

i have function delete 2 dimensional struct, not fast, guess there faster way this(like memset or something), idea appreciated;) void freealllistnode(listnodeptr *sptr[][10]) { listnodeptr temp; (char = 0; i<19; i++){ (char di = 0; di<10; di++){ while (sptr[i][di] != null){ temp = *(sptr[i] + di); *(sptr[i] + di) = temp->next; free(temp); } } } } and struct definition, in case if it's necessary typedef struct listnode{ char* val ; struct listnode *next; }listnode; using listnodeptr = listnode*; no. memset never replacement malloc/free, in circumstance. different things. proposal memset somehow replacement malloc/free fundamental misunderstanding of how dynamic memory, , dynamic scope allocation works. the thing remotely implement standard c++ library containers custom allocation class. is, std::list , std::vector , , others, , none of manual link list implementation. standard c++ lib

Yum downgrade when the newer release has an extra RPM -

in latest release have added new rpm. during upgrade older version, works fine because have added dependency in spec file of main rpm. here dependency tree: older release: rpm1 depends on rpm2 newer release: rpm1 depends on rpm2 , rpm3 rpm3 depends on rpm2 upgrade works fine when try yum upgrade rpm1 . how downgrade older version? specifying rpms yum downgrade rpm1 rpm2 rpm3 doesn't work. yum downgrade rpm1 , rpm2 not work because rpm3 depends on latest version of rpm3. there no easy way approach this. might have go "behind yum 's back" , use rpm directly force erase rpm3 , should able downgrade rpm1 , rpm2. other option uninstall 3 , reinstall older versions of 1 , 2.

sqlite3 - Replicating Django User Passwords -

i trying seperate current django sqlite3 database 2 databases. requires replicating user accounts old database new one. possible replicate/copy user object since raw password not stored? yes, can replicate. django authenticates users using password hash. make sure have same password hashers enabled in settings.py i.e. password_hashers = ( 'django.contrib.auth.hashers.md5passwordhasher', )

apache - How to open multiple websockets on the same port -

so i'm using ratchet websockets in laravel application , i'm wondering, if it's possible open multiple websocket servers on same server , same port? want have apache , 2 seperate socket servers on same machine , on port 80 , access them different sub domains, example mypage.com, socket1.mypage.com, socket2.mypage.com

php - Why can magento behat test not find my database? -

when call bin/behat execute tests, error: test.dev bin/behat [zend_db_adapter_exception] sqlstate[hy000] [2002] no such file or directory [pdoexception] sqlstate[hy000] [2002] no such file or directory this composer.json : { "require": { "php": ">=5.4.0" }, "require-dev": { "magetest/magento-behat-extension": "dev-develop", "magetest/magento-phpspec-extension": "~2.0", "peridot-php/webdriver-manager": "dev-master", "bossa/phpspec2-expect": "dev-master", "behat/mink-extension": "*", "behat/mink-goutte-driver": "*", "behat/mink-selenium2-driver": "*", "behat/mink-selenium-driver": "*" }, "autoload": { "psr-0": { "": [

javascript - Why jQuery data won't work with append? -

i appending data server unordered list, setting data-id attribute data() doesn't work, attr() does. when using data() : appends <li>home</li> $('#menu').append($('<li>').text("home").data('id', 5)); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <ul id="menu"> </ul> when using attr() : appends <li data-id="5">home</li> $('#menu').append($('<li>').text("home").attr('data-id', 5)); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <ul id="menu"> </ul> i know append so, prefer first option. $('#menu').append('<li data-id="5">home</li>'); the .data() method read data-* attribute secondary function. first tries

entity framework - Get Object reference not set to an instance of an object. Error from Linq -

this question has answer here: what nullreferenceexception, , how fix it? 33 answers i object reference not set instance of object. error here code: public actionresult profile(string id) { news_application.newsdatabaseentities db = new news_application.newsdatabaseentities(); var result = (from u in db.aspnetusers u.id == id select new { u.id, u.writername, u.profilepicture }).firstordefault(); userviewmodel mo = new userviewmodel(); mo.id = result.id; mo.writername = result.writername; mo.writerimage = result.profilepicture; return view(mo); } please me. thank much i think linq query giving null condition have. trying access property values of result without checking whether null or not pu

java - How to skip a header after regex match and read next line using BufferReader -

i have stream continue print rows follows: 11:19:54 cpu %user %nice %system %iowait %steal %idle 11:19:55 0.00 0.00 1.00 0.00 0.00 99.00 average: 0.00 0.00 1.00 0.00 0.00 99.00 11:19:55 cpu %user %nice %system %iowait %steal %idle 11:19:56 0.00 0.00 1.00 0.00 0.00 99.00 average: 0.00 0.00 1.00 0.00 0.00 99.00 ....so on java code is: public final static string regex_starts_with_time = "[0-9]{2}:[0-9]{2}:[0-9]{2}\\s+[a-z]{2}\\s"; public final static string regex = regex_starts_with_time + "cpu\\s+%usr\\s"; string line; try { inputstream = process.getinputstream(); bufferedreader br = new bufferedreader(new inputstreamreader(is)); while ((line = br.readline()) != null) { line.matches(regex); //here

BackUp and restore db with MongoDB java driver -

is there possibility in mongodb java driver make backup , restore db? my solution (just execute command) now: public void makebackup(string path) { try { runtime.getruntime().exec("mongodump --out " + path); } catch (ioexception ex) { logger.getlogger(mongodb.class.getname()).log(level.severe, null, ex); } } public void restore(string backuppath) { try { runtime.getruntime().exec("mongorestore " + backuppath); } catch (ioexception ex) { logger.getlogger(mongodb.class.getname()).log(level.severe, null, ex); } } thanks in advance. the short answer no @ now. these commands can invoked command line. might consider fetch data collections expected slow. can read discussion around here

spring - timeout interval between receiving a message and acknowledging it -

what timeout interval ( between receiving message , acknowledging ) if using activemqsession.individual_acknowledge , can configure it? the spring code queue activemqconnectionfactory amqconnectionfactory = new activemqconnectionfactory(); cachingconnectionfactory cachingconnectionfactory = new cachingconnectionfactory(amqconnectionfactory); activemqqueue activemqqueue = new activemqqueue("cr.default.queue"); jmstemplate jmstemplate = new jmstemplate(); jmstemplate.setconnectionfactory(cachingconnectionfactory); jmstemplate.setdefaultdestination(activemqqueue); jmstemplate.setsessionacknowledgemode(activemqsession.individual_acknowledge); jmstemplate.setreceivetimeout(jmsdestinationaccessor.receive_timeout_no_wait);

c++ - Calling external program using boost::process causes caller to hang (Linux) -

i using boost::process call external program - external program reads input via stdin, , writes stdout , stderr. external program follows (expects single argument - path file debugging) #include <fstream> #include <iostream> #include <stdexcept> #include <string> #include <vector> int main(int argc, char** argv) { try { if (argc != 2) { throw std::logic_error("expected 2 arguments"); } std::ofstream ofs(argv[1]); std::vector<std::string> sometestinput; ofs << "starting program..." << std::endl; // read cin { ofs << "reading cin..." << std::endl; std::string input; while (std::getline(std::cin, input)) { ofs << "received cin: " << input << std::endl; sometestinput.emplace_back(input); }

Cython: share pure python module -

i have 1 pure python module a.py file containing class enhanced cython: @cython.cclass class test how can use class in pure python module b.py ? tried from import test cython compiler tells me not type wherever use test in b.py as said in comments, can using .pxd files in addition .py files specify types in. realise isn't elegant putting in .py files, far know it's best can do. a.py: class test: pass a.pxd: cdef class test: pass b.py: # here use test in places think want use it: # function argument # variable in function # in class import def f(x): return x def g(): t = a.test() return t class c: pass b.pxd: import cython cimport cpdef f(a.test x) @cython.locals(t=a.test) cpdef g() cdef class c: cdef a.test t you can verify it's using type information correctly inspecting generated b.c file. for reference, relevant documentation http://docs.cython.org/src/tutorial/pure.html#magic-attributes-w

Kafka startup fails with zookeeper timeout (remote server), yet the machine can connect to zookeeper directly -

when start kafka up, fails while complaining cannot connect zookeeper. running zookeeper standalone cluster/ensemble. confused because there no firewall between servers (as evidenced zookeeper-shell.sh test). from /var/log/kafka/server.log 2016-02-24 16:07:12,101 info kafka.server.kafkaserver: [kafka server 1], connecting zookeeper on 10.7.20.100:2181,10.7.20.101:2181,10.7.20.102:2181 2016-02-24 16:07:20,291 fatal kafka.server.kafkaserverstartable: fatal error during kafkaserverstable startup. prepare shutdown org.i0itec.zkclient.exception.zktimeoutexception: unable connect zookeeper server within timeout: 6000 @ org.i0itec.zkclient.zkclient.connect(zkclient.java:880) @ org.i0itec.zkclient.zkclient.<init>(zkclient.java:98) @ org.i0itec.zkclient.zkclient.<init>(zkclient.java:84) @ kafka.server.kafkaserver.initzk(kafkaserver.scala:113) @ kafka.server.kafkaserver.startup(kafkaserver.scala:69) @ kafka.server.kafkaserverstartable.startup(kafkase

regex - How to print tablename and primary key from file.sql in python -

i have requirement print tablename , primary key using below program. not working. please in solving this. have used regex pattern find out table name , primary key data in database schema. class parsecreatefile: begin = re.compile(r"create \s+ table \s+'((?:[^']|'')*)'.+(primary \s+ key\s? \([^)]*\))", re.ignorecase | re.verbose | re.dotall) def __init__(self,filename): self.filename = filename self.readfromfile() def readfromfile(self): try: file = open(self.filename,'r') filedata = file.read() file.close() self.parse(filedata) except ioerror: print 'unable read file %s' % self.filename def parse(self,rawdata): self.list = [] while rawdata: mo = self.begin.search(rawdata) tablename, fil = mo.groups() print tablename, fil if mo none: break rawdata

android - IBM Mobile Firsts 7.1.0 - Error to deploy in AppCenter -

Image
when performing uploading of apk file, error below: fwlac0000e: server error detected. [com.ibm.puremeap.resources.exceptions.systemexception: null source] production environment - java 8 sdk websphere application server v8.5.5.8 mysql 5.6 stacktrace: ******************************************************************************** product = websphere application server 8.5.5.8 (wlp-1.0.11.cl50820151201-1942) wlp.install.dir = e:/mobilefirst/ibm/websphere/liberty/ java.home = e:\stonesales\bin\java\jdk1.8.0_25\jre java.version = 1.8.0_25 java.runtime = java(tm) se runtime environment (1.8.0_25-b18) os = windows server 2008 r2 (6.1; amd64) (en_us) process = 2192@plutao ******************************************************************************** [25/02/16 09:21:38:531 brt] 00000001 com.ibm.ws.kernel.launch.internal.frameworkmanager cwwke0001i: server appserver has been launched. [25/02/16 09:21:42:063 brt] 00000001 com.ibm.ws.kernel.launch.internal.framew

android - Different Colors in hint -

Image
i using textinputlayout hint in edittext . now, want give hint textinputlayout 2 colors. like in image shown : is possible? have tried adding text in html format not working. code edittext : <android.support.design.widget.textinputlayout android:id="@+id/pv" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="property value" android:layout_margintop="5dp" app:hinttextappearance="@style/hinttext" > <com.app.aspirehomeloans.fontclass.edittext_robotoregular android:id="@+id/login_emailid" android:layout_width="match_parent" android:layout_height="match_parent" android:textsize="@dimen/edittext_size" android:paddingtop="3dp" andro

token - Decoding HS256 in client side? -

i'm using json web tokens app. when login site , want see user logged in, have stored token needed data in encoded in hs256. should use token payload show "hello ..." , user name inside payload, or should decode token server side , retrieve user data there? is there client-side library decode hs256 me use? or bad practice , should avoided. jwt self-contained , protected digital signature. can use information contained in token, should validate expiration time , ensure digital signature has not been altered. to verify signature on client side need key asymmetrical , use public key verify. may send token server save problems. depends on operation take risk, long token used autenthication on server , performs validation is there client-side library decode hs256 me use? or bad practice , should avoided. in fact, not need library. payload base64 url encoded, , can decoded in programming language. need library verify digital signature. take @ jwt.i

python - Importing function to new file not working -

my program designed create module named mytriangle reads 3 sides of triangle , computes area if input valid. if input invalid, display "input invalid". program works beautifully. problem trying import module (everything except main function) on different file. have never done before, , can't find anywhere gives clear instructions. here code: side1, side2, side3 = eval(input("enter 3 sides in double: ")) def isvalid(side1, side2, side3): return side1 + side2 > side3 , side1 + side3 > side2 , side2 + side3 > side1 def area(side1, side2, side3): s = (side1 + side2 + side3) / 2; totalarea = (s * (s - side1) * (s - side2) * (s - side3)) ** 0.5 return totalarea def main(): condition = isvalid(side1, side2, side3) totalarea = area(side1, side2, side3) if condition: print("the area of triangle " + str(totalarea)) else: print("input invalid") main() i tried taking "

Using XSLT, how to remove the empty element, which does not have an attribute or data, in an XML document? -

we want remove empty tag commentline xml <commentline/> input xml : <?xml version="1.0" encoding="windows-1252"?> <salesorders xsd:nonamespaceschemalocation="sdoc.xsd" xmlns:xsd="http://www.w3.org/2001/xmlschema-instance"> <orders> <orderheader> <customerponumber>ab-54354</customerponumber> </orderheader> <orderdetails> <commentline> <comment>ensure saddle color coded</comment> <orderlineid>or-1810127</orderlineid> </commentline> <commentline> <comment>edi-001</comment> <orderlineid>or-1810128</orderlineid> </commentline> <stockline> <customerpoline>9999</customerpoline> <stockcode>absh-smh-12oz-01</stockcode> <stockdescription>smh abs balan

html - DIVitis from React -

i started working @ company use react , noticed html output has ton of unnecessary divs. developers tell me it's necessary react, find hard believe modern framework/library/tool force bad html practices on us. however, can't seem find articles or references on issue online. neccessary wrap div? why can't wrap semantically correct element, p tag or nav, etc.? , finally, acceptable development community? you can use valid html5 tag in react.js long return single dom node component render method. requirement. list of supported tags , attributes

reactjs - Typography and spacing in material-ui -

i defined raw theme material-ui in theme.ts : import {colors, spacing} 'material-ui/lib/styles/'; import {colormanipulator} 'material-ui/lib/utils/'; import {styles} 'material-ui'; export default <styles.rawtheme> { spacing: spacing, fontfamily: 'roboto, sans-serif', palette: <styles.themepalette> { primary1color: colors.red500, primary2color: colors.red700, primary3color: colors.lightblack, accent1color: colors.orangea200, accent2color: colors.grey100, accent3color: colors.grey500, textcolor: colors.darkblack, alternatetextcolor: colors.white, canvascolor: colors.white, bordercolor: colors.grey300, disabledcolor: colormanipulator.fade(colors.darkblack, 0.3), pickerheadercolor: colors.red500, } }; then in custom react component app.tsx applied theme: import * react 'react'; import {appbar, appcanvas} 'materi

finance - Plot issue (actual and fitted values) in factorAnalytics package in R -

Image
i moving first steps factoranalytics package. running factoranalytics v.2.0.30 (the latest version afaik) in r 3.3.1 (64bit) rstudio in windows. i running code (taken of plot.tsfm): library(factoranalytics) data(managers) fit.macro <- fittsfm(asset.names=colnames(managers[,(1:6)]), factor.names=colnames(managers[,(7:9)]), rf.name="us.3m.tr", data=managers) range(index(managers)) plot(fit.macro, plot.single=true, asset.name="ham1", which=1) the plot supposed show actual , fitted value of ham1 on period 1996-2006, have this: actual , fitted:ham1 that is, graph shows actual values 1996 , no fitted values @ all. tried same instructions other time series included in same database , same issue. tried run same code rgui (to check if rstudio issue) did not help. i appreciate suggestion v2.0.33 latest version of factoranalytics. have version on machine , not able reproduce issue while running code. below

Not able to set number in Restrictions.ilike("id" ,"+"searchTerm"+") in hibernate -

i have student class attribute name , id property. name || id rahul11 101 sam 110 i make 1 search bar in if search 11 display thing start 11 in student class. how achieve criteria.add(restrictions.****) edit: using search term string

intellij idea - How to configure the Coverage plugin to append coverage suites? -

coverage plugin intellijidea (going many releases). captures code coverage statistics given run configuration. according documentation should able append results multiple runs either selecting default behavior or having intellij prompt settings before applying coverage editor. but settings never seem applied. if choose prompted; i'm never prompted. if choose append them; they're never appended. 1 member on team says are prompted results not reflect choice. i've tried can think of: manually changed settings coverage in workspace.xml file deactivated , reactivated coverage uninstalled , reinstalled coverage tried using other runners coverage (emma , jacoco) even uninstalled , reinstalled intellij hopes carrying around faulty settings previous install. nothing works. am missing obvious; how configure coverage append coverage suites? i'm thinking it's bug there perhaps workaround possible? there's workaround doesn't involve appe

python - How can I check that a text file has at least 1 character -

i have text file how can check in python text file has @ least 1 number or alphabetic character , not white spaces. here did. read file putting data string data . used data.strip() remove leading , trailing whitespace. checked see if there left data.strip() . if there have characters in file, if not file has whitespace or empty. with open("filename.txt", "r") file: data = file.read() if data.strip(): print("empty") else: print("full")

Prestashop : out-of-ranges orders -

i have question carriers. is possible, in case of "out of range behavior", "duplicate" shipping fees ? for instance, carrier set price according weight ranges, higher range 5-8 kg. so, if customer orders 100 products of 1kg, shipping fees stay same if ordering 8 products of 1 kg. i don't know if made myself clear enough, but... there solution, problem ? thank you. you can set price total weight in carrier configuration page. price total weight should calculated dependently each products quantities. so can set different weight ranges example 0 15kg => 8€, 15kg 40kg => 12€ , on 40kg => 15€. here official documentation .

how to keep track of time after object is created in java -

i not sure how build setup in java once make object, want object destroyed after amount of time. want destroy object when trigger it. object destroyed after set time sure can destroyed trigger. however, want object interactive other function until destroyed. can me function use , how build it. you can use long timenow = system.currenttimemillis(); if need

ruby on rails 3 - undefined method `article_name' .................NoMethodError in ArticlesController#create -

class articlescontroller < applicationcontroller def index @articles = article.all end def show @article = article.find(params[ :id]) end def new @article = article.new end def create @article = article.new(article_params) if @article.save redirect_to @article else render 'new' end end private def article_params params.require(:article).permit(:article_name,:enter_text) end end try with: ..... .permit(:name, :enter_text)

apache - htaccess subpage on subdomain to subpage on other subdomain -

i have trouble finding out right approach make 301 redirect 1 subdomains page subdomains page. for instance: subpage1.mysite.com/contact needs redirected subpage2.mysite.com/kontakt (i have few hundred of these) i have lot of 301 redirects in .htaccess far, redirect maindomain mysite.com/page. i cant make 301 this, right? not work.. 301 redirect 301 http://subpage1.mysite.com/contact http://subpage2.mysite.com/kontakt i can access primary htaccess file on main domain (mysite.com) read rewritecond seems take of subpages , redirect them other subdomain. not suitable me, url's have changed names , not identical on subdomains. i've figured out using this. taking subdomain rewritecond #consultancy redirects rewritecond %{http_host} ^consultancy.madebydelta.com [nc] rewriterule ^about/$ http://testlab.madebydelta.com/om-os/ [r=301,nc,l] rewriterule ^industries/$ http://testlab.madebydelta.com/cases/ [r=301,nc,l]

Is there a way to create a table variable in postgresql -

i have created function creates temporary table , inserts table. problem need work in read-only instance , in read-only instance can't create table and/or insert it. there other way of doing this? maybe creating table variable in way similar other sql languages? i did research , there doesn't seem table variable, maybe array of records? ideas? update: answer people's questions, trying create function returns list of dates until x intervals ago in intervals of y. instance select * getdates('3 days', 1 day') returns: startdate | enddate ------------+------------ 2016-07-20 | 2016-07-21 2016-07-19 | 2016-07-20 2016-07-18 | 2016-07-19 and select * getdates('3 months', '1 month'); returns: startdate | enddate ------------+------------ 2016-07-01 | 2016-08-01 2016-06-01 | 2016-07-01 2016-05-01 | 2016-06-01 i using while loop , going per interval until hit time given first parameter. insert values temp table , when finish