Posts

Showing posts from April, 2013

java - Can't get linkedin profiles summaries using Spring social -

i'm trying access basic profiles datas springsociallinkedin 1.0.0.rc3. here how proceed : string industry = connection.getindustry(); string headline = connection.getheadline(); string summary = connection.getsummary(); let's know picture random connection having these fields fill. i'll industry , headline . however, in place of summary, i'll null value. consequence, wondering : known bug due version of module or there wrong elsewhere ? edit : nice fellow, managed make 1.0.0.3 run nicely. however, still can't manage connections summaries. edit bis : can own summary. contact's summaries hidden app. in fact, trouble comes linkedin. however, there way dodge problem using linkedin.restoperations() supplied spring social. here how proceeded : string url = string.format("https://api.linkedin.com/v1/people/id=%s:(summary)", connection.getid()); linkedinprofile summaryprofile = source.restoperations().getforobject(url, linkedinprofile.cl...

sql - how to set return type of a stored procedure -

i using stored procedure alter procedure [dbo].[myprocedure] @pselect nvarchar(max) begin set nocount on; declare @sql nvarchar(max) set @sql = 'select' + @pselect + ' ' tabel1; exec sp_executesql @sql end it returning me integer type value want return value of type tabel1 is possible try this: alter procedure [dbo].[myprocedure] (@pselect nvarchar(max)) begin set nocount on; select @pselect table1 end call stored procedure as: exec myprocedure 'field_name' i hope trying do.

activemq - How to escape a special character (forward slash) in a mqtt topic? -

i have application using mqtt-client java library connect activemq broker via mqtt. subscribing, publishing , receiving of messages work fine long topic not have forward slash (/). i understand forward slashs special characters in mqtt , per activemq mqtt support "/" converted "." . however, in case, need connect topics have been created using jms , written uri (example http://activemq.apache.org/ ) , therefore have "/" on names. is there anyway scape "/" on mqtt? @ moment, if try connecting topic called http://activemq.apache.org/ in fact connect http:..activemq.apache.org. my suggestion.. works if you're deploying own activemq service.. download activemq source.. conversions occur in module mqttprotocolconverter. there you'll see special conversions.. code has changed in 5.10.0, needless can escape stuff there , should work. modified code both inbound requests mqtt , outbound. i have had similar issues when tr...

qt - How to prepend a child item in qtreewidgetitem? -

i want keep latest child nodes in top level items in qtreewidget, how possible ? normally qtreewidgetitem::addchild() append child item, tried qtreewidgetitem::insertchild(0, childitem) doesnt helped me. i using qt 4.8.4 (msvc 2010, 32 bit), in win 7. you can read in documentation of qtreewidgetitem::insertchild if child item inserted in tree widget, insert again not produce effect. then workaround use qtreewidget::removechild before, , after insert @ first place.

To get twitter consumer key and secret from my site using twitter login(OAuth) -

need twitter customer key, secret key, access token, access token secret website. when user login twitter site, should fetch these keys account using twitter oauth. need post tweets automatically user's account, wants auto notification service.

php - Mail Gun Sending via HTTP returns Server response: 550 5.1.0 Recipient rejected -

$ch = curl_init(); curl_setopt($ch, curlopt_httpauth, curlauth_basic); curl_setopt($ch, curlopt_userpwd, 'api:key-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_customrequest, 'post'); curl_setopt($ch, curlopt_url, 'https://api.mailgun.net/v2/domain.com/messages'); curl_setopt($ch, curlopt_postfields, array('from' => 'excited user <administrator@domain.com>', 'to' => 'tester@otherdomain.com', 'subject' => 'test', 'text' => 'message')); $result = curl_exec($ch); above snippet of send function. if user gmail, or yahoo or aol on otherdomain, message sent. if use custom otherdomain, returns server response: 550 what did...

ASP.NET C#: Will <%:myInt%> result in boxing? -

passing value type type object function in c# , boxing occurs. in asp.net have shorthand's response.write(..) , response.write(server.htmlencode(..)) respectively, <%= , <%: response.write(..) exist overloads char, string , object - therefor assume code result in response.write(object) being called , int being boxed: <%int myint = 3;%> <%=myint%> while understand version not result in boxing: <%=myint.tostring()%> (correct me if i'm wrong here) but <%:? server.htmlencode() takes string parameter , can not called type of object. happening in situation: <%:nyint%> will webform view engine "compile" response.write(server.htmlencode(myint.tostring)) a "magic no boxing" scenario? update following joe’s example shows <%:nyint%> translated to @__w.write(system.web.httputility.htmlencode(myint)); system.web.httputility.htmlencode has overload object - means conclusion <%: myint%> caus...

wcf - Implementing OData with custom DAL -

we have custom (.net/sql based) dal , expose odata capabilities. in first instance interested in allowing simple querying of data, later want allow updates, , guess there security issues think about. we're looking @ "apps" , using jaydata/breeze manage communication. we have rich set of metadata allows attach calculated columns our datasources can retrieved our dal if db columns. we not use ef @ all. how start exposing data via odata? heavily invested in our dal works our windows based applications. implementing iqueryable sounds monumental task. should use wcf services or web api? this article looks start, i'm thinking can maybe odataqueryoptions , reinterpret our dal can work with. http://blogs.msdn.com/b/webdev/archive/2013/02/25/translating-odata-queries-to-hql.aspx there's not documentation on of though , i'm reluctant started without checking there's not easier alternative i've missed. is looking for? http://msdn.microso...

git diff - List out all the files that I have pushed to the remote Git repo -

how list out files have pushed in last push remote git repository? i have project , have modified few files , add, commit , push remote. how see list of files have pushed remote? should have last commit id? you can use remote-tracking branches , reflog see changes have pushed. example, if pushed code origin/master , can list files changed following: git diff origin/master@{1} origin/master --name-status the syntax says take difference between origin/master@{1} , i.e. origin/master @ 1st previous position, , current state of origin/master , last known local repo.

fullcalendar events not showing results when set to json -

the ajax call result form web service returned below "[{title:'111',start:'2013-08-09'},{title:'222',start:'2013-08-05'},{title:'333',start:'2013-08-10' }]" when string set "events" in fullcalendar calendar works fine but when set msg.dashboardcalendardetails result of ajax calendar not show cells changed i want set events json result service here sample fiddle http://jsfiddle.net/fk4sq/ event start , end dates must in iso 8601 format, 2013-08-28t19:10:00-04:00 . can use fullcalendar $.fullcalendar.formatdate(from, format); convert date , time. events: [{ title: 'event 1', start: '2013-08-28t19:10:00-04:00', end: '2013-08-29t19:20:00-04:00', allday: false },{ title: 'event 2', start: '2013-08-28t16:25:00-04:00', end: '2013-08-28t18:45:00-04:00', allday: true }]

php - Web project development in subfolder -

for example working on 2 projects, & b, both of them in future hosted in root directories. atm have 1 apache web server default parameters , want start working, create folder , folder b, store needed files. the problem when ll use <script type="text/javascript" src="/resources/scripts/javascript.js" ></script> <link href="/resources/styles/stylesheet.css" rel="stylesheet" type="text/css" /> both of projects call files apache root folder (httpdocs), not /a/ , /b/ folders. things worse when using php framework, cant use <link href="./resources/styles/stylesheet.css" rel="stylesheet" type="text/css" /> (dot before /resources/) because routing project trying access controller folder , resources there. sounds small problem, cant figure out , close question myself, each time need develop invent workarounds again , again :) a way of handling use constant h...

python - how can i predict my variables -

i made code works patsy , formula, wanted make 'predict' verify results found summary. how can predict variables? import numpy np scipy import stats import scipy import matplotlib.pyplot plt import statsmodels.api sm statsmodels.formula.api import logit, probit, poisson, ols fname ="c:/users/lenovo/desktop/table.csv" my_data = np.genfromtxt (fname, delimiter = ',') x = my_data [:,1] d = my_data [:,4] f=my_data[:,6] c= my_data[:,3] #crée un masque pour les valeurs nans masque = ~ (np.isnan (x) | np.isnan (d) | np.isnan (f) | np.isnan (c)) x = my_data[masque, 1] - 1 d = my_data[masque, 4] f = my_data[masque, 6] c = my_data[masque, 3] my_data_dict = dict ( x = x, d = d, f = f, c=c ) form = 'x ~ c(c)+c(d)+c(f)' affair_model = logit (form, my_data_dict, manquant = 'drop') affair_result = affair_model.fit () print affair_result.summary () in line: data = df[cols_to_keep].join(dummy_ranks1.ix[:, 'c_2':]).join(dum...

wicket - Link to last version of stateful page -

i have number of stateful pages state each page. example each page has form submitted. how can organize menu links last versions of these stateful pages? should store anywhere (may in session) reference appropriate object each page? if use onclick() { setresponsepage(mypage.class); } than lose previous state of page. want link last state of page. each time page rendered store page's id in session. int pageid = pageinstance.getpageid(); a list or stack data structure used hold identifiers. you can implement navigation menu using repeater (repeatingview or such) creates new link each page id in session. in link's click handler can redirect user follows: page pageinstance = (page) new pageprovider(pageid, null).getpageinstance(); setresponsepage(pageinstance);

hardware - find a graphic card that suits a specific motherboard -

i want search graphic card suits motherboard, don't know how! example, have motherboard , don't know type of graphic card should search for. to answer question, depends on budget , how power power supply can handle. ecs not considered high end motherboard manufacturer don't matter. the graphics card cpu, requires power, lot of @ times. when game runs, heavily depends on gpu run game draws lot of power. can see on motherboard has 16x pci express card, meaning take card supports x16 pci express. expansion slot 1 x pci express x16 gen2.0 slot <<--- here now problem determining how power need. i'd recommend getting getting power supply has @ least 2 -> 6 pin plugs (you can google that) , @ least 600 watts of power or more support graphics card buy.

Spring Security all rolles except anonymous -

hi have spring security application <http auto-config="true"> <intercept-url pattern="/**" /> <form-login authentication-failure-handler-ref="authenticationfailurehandler" authentication-success-handler-ref="authenticationsuccesshandler" login-page="${loginurl}" authentication-failure-url="${loginurl}" /> <logout logout-url="/logout" invalidate-session="true" success-handler-ref="logoutsuccesshandler" /> <anonymous enabled='false'/> </http> but anonymous user not intercepted, how can allow roles not role_anonymous? try is_authenticated_fully : <intercept-url pattern="/**" access="is_authenticated_fully" /> you can same thing using spel expression: <http auto-config="true" use-expressions="true"> ... <intercept-url pattern="/**" access=...

Date Range Query not returning all records - SQL -

i have sql db need filter results based on month inventory items completed in order billing. the field i'm working called completiondate. here code i'm using. input name='criteria' type='hidden' value="where completiondate between '8-1-2013' , '8-31-2013'" i of records returned not all. suspect problem lies in format of completiondate field. varchar(10). storing data in field in format mm-dd-yyyy. after searching understand since field in varchar datatype above mentioned code not going work way want to. i've tried no avail. input name='criteria' type='hidden' value="where to_date(completiondate, 'mm-dd-yyyy') between to_date('8-1-2013', 'mm-dd-yyyy') , to_date('8-31-2013', 'mm-dd-yyyy')" can guide me solution? because field of type varchar, not searching date range text range. should store dates in date type field, because can , efficien...

asp.net - Know if a record was just inserted via C# 4.0? -

is possible in c# / asp.net know if executenonquery inserted record or not? i checking make sure email address not exist in table using subquery. is there way know if insert made in asp.net? commandprizeemails.parameters.add("@email", sqldbtype.varchar, 50); commandprizeemails.parameters.add("@datetoday", sqldbtype.datetime); commandprizeemails.parameters["@email"].value = txtemail.text; commandprizeemails.parameters["@datetoday"].value = datetime.now; commandprizeemails.executenonquery(); //int newid = (int)commandprizeemails.executescalar(); //commandprizeemails.executenonquery(); //if (newid >= 1) { // divsuccesfulentry.visible = true; //} else { // divrepeatentry.visible = true; //} you can rows affected in return verify process. for update, insert, , delete statements, return value number of rows affected com...

iphone - Combine MKMap and Cocos2D -

Image
i'm looking best possible solution combine mkmap cosos2d. the outcome i'm hoping achieve create game player can run in streets (viewed above) on mkmap. player should able run in streets, if player tries run off streets, boundary need restrict player doing so. cars driving in streets, player shouldn't able run on them. the best example of i'm trying achieve game called gta. (the older versions) example: you no information roads , stuff.... go check pixel colors don't think thats pratical sorry i'd wrong approach. instead maybe use open street map xml!?

Can I add cookie with Spring SockJs websocket implementation -

can add custom cookies on websocket in spring sockjs implementation? way can add http request/ response? forget mention see way read cookie headers :: httpheaders headers= session.gethandshakeheaders(); -but not see way set headers. headers can read cookies -but how set it? this work-in-progress still, @ time can configure handshakeinterceptor on defaultsockjsservice. gives access request , response before , after handshake.

What is facebook's Page / Checkin Pagination limit on search? -

i can't seem find in documentation anywhere, , seem return 50 results when querying. https://graph.facebook.com/search?q=coffee&type=place&limit=100&offset=200 any , requests facebook's api has default limit of 50. can add limit=x parameter request make graph api. for example, 300 results users feed, use this: https://graph.facebook.com/user_id/feed?limit=300

c++ - Charset used by boost-asio error message -

i using boost-asio , want process correctly error message. in example, made typo (1278 instead of 127): boost::system::error_code ec; auto address=boost::asio::ip::address::from_string("1278.0.0.1",ec); if(ec) { const char*text=ec.message().c_str(); //do text encoding ? } i error message , seems encoded in windows 1252 (i using windows 7). seems encoding os encoding. however, unable find documentation states fact. are error message in boost asio encoded os character set ? after digging boost on system, found included hpp files include ipp file in turn calls os functions. if there error, code of error known @ stage. the real error message formed when message() function called. the implementation on windows calls formatmessagea or formatmessagew depending if boost_no_ansi_apis defined: std::string system_error_category::message( int ev ) const { # ifndef boost_no_ansi_apis lpvoid lpmsgbuf = 0; dword retval = ::formatmessagea( ...

R cannot declare setClass with inheritance -

removeclass("a") setclass('a',representation=representation(a="numeric")) setmethod('initialize','a', function(.object,...,a){ .object@a=a .object }) ok here removeclass("b") setclass('b',representation=representation(b="numeric"),contains="a") this code fails on definition of class "b" , without had chance add initialize method "b", , without create object error in .local(.object, ...) : argument "a" missing, no default it not fail if add default value parameter in initialize.a method can explain why ? "why" tricky question, answer being "because" it's implemented way. if you're asking needs done avoid this, answer either (a) provide default value argument a in constructor or (b) avoid using initialize method. there discussion here . implicit contract new("a") succeeds,

linux - Can I call a local function from ssh? -

i know can call variables local shell in ssh session, assumed call function way too. doesn't seem work. i have script checks if local machine can handle operations , if can need call local functions, if local machine cannot need ssh remote machine , call local functions. canhandle() { if [ -d /this_must_exist/ ] return 0 else return 1 fi } localfunction() { // predefined tasks } canhandle if [ $? -eq 0 ] // process locally using predefined functions localfunction else ssh -t me@server << endssh // process remotely calling predefined local functions localfunction endssh fi imho not work. local variables expanded on local shell, , transferred expanded. you write bash script doing same local function, , write function copy via scp remote system, execute there via shh , delete afterwards.

matlab - Adjusting image intensity values -

i came imadjust function in matlab . seems function enhances contrast of image. but, theoretical basis function? in other words, if function mentioned in documentation adjusts image intensity values, mean? doing intensity values? thanks. the formula each pixel be j = ((((i - low_in) / (high_in - low_in)) ^ gamma) * (high_out - low_out)) + low_out if leave off parameters, low_in , high_in automatically selected output contains 1% of pixels @ highest , lowest values.

java - saving twitter4J Status to MongoDB gives "twitter4j.Status is an interface, and JAXB can't handle interfaces" -

trying save list<status> mongodb (via morphia), , compile time error: com.sun.xml.ws.spi.db.databindingexception: com.sun.xml.bind.v2.runtime.illegalannotationsexception: 1 counts of illegalannotationexceptions twitter4j.status interface, , jaxb can't handle interfaces. problem related following location: @ twitter4j.status @ public java.util.list model.twitterjob.getstatuses() any idea? lot! it's little complicated marshal status , because class statusjsonimpl implements status in twitter4j 3.0 protected. need override class , make visible classes. please checkout following example detail. https://github.com/phstudy/twitter4j_jaxb_example

java - Strange tab-order with editable JComboBoxes -

Image
i've got jframe looks this: it's got 2 jtextfield s on it, 1 jcombobox between them , jpanel @ bottom (that can't see). one of features of jcombobox can given custom editor. these implement comboboxeditor interface. in each of following 3 cases, gui looks same, , have expected them behave same: i not specify custom editor, , use default one. i create custom editor editor component jtextfield . i create custom editor editor component jpanel jtextfield on (using borderlayout ). when editor editable combo box set default, pressing tab moves focus top jtextfield editing area on jcombobox , other jtextfield . if create custom editor editor component jtextfield , otherwise expect, same thing happens. but , if instead create custom editor editor component jpanel jtextfield add ed it, focus makes 1 additional stop. if focus on top jtextfield , pressing tab moves focus little arrow @ right of editable combo box before moving text area. why...

javascript - what HTML5 video listener can trigger event in the beginning of a video? -

i want use listener trigger function in beginning of 1 video. using: video.addeventlistener("play", function); it works in desktop. in ios, function triggered when pause re-start video. so, how should make listener trigger function in beginning of video? video may auto play or click play. thanks lot in advanced! you can use: video.addeventlistener("loadedmetadata", function) i not sure event won't send before starting film can use also: var firsttime = yes; video.addeventlistener("progress", function() { if (firsttime) { firsttime = no; // want here } }); for events supported safari/webkit go https://developer.apple.com/library/safari/documentation/audiovideo/reference/htmlmediaelementclassreference/htmlmediaelement/htmlmediaelement.html . lecture.

c - libspotify crashes with segFault after calling sp_session_create -

i testing out libspotify library (version 12.1.51 x86 linux) , application keeps crashing when call sp_session_create() segmentation fault. i don't have application key, nor premium spotify account (yet), shouldn't reason crash, since if remember correctly, there error code invalid application key. my code follows: static uint_8_t g_appkey[] = {1, 2, 3}; static const char *username = "myusername"; static const char *password = "mypassword"; static int logged_in; static sp_session_callbacks session_callbacks; static sp_session_config spconfig; static void on_login(sp_session *session, sp_error error) { printf("callback: on_login"); if (error != sp_error_ok) { printf("error: unable login: %d\n", (int) error); exit(-1); } logged_in = 1; } static void on_main_thread_notified(sp_session *session) { printf("callback: on_main_thread_notified"); } static void on_log_message(sp_session *s...

php - Displaying the categories and subcategories - wordpress -

i have lot of categories , subcategories in site. display them manually, mean wrote: <ul> <li>..menu..</li> <li>..menu..</li> </ul> i'm sure there right way it. i'm sure there function that. can tell me ? thanks sure, can use wp_list_categories() http://codex.wordpress.org/template_tags/wp_list_categories

Tcl - Accessing Fields from a C Struct -

i'm trying automation in orcad capture using tcl scripting interface. i've run problem of receiving struct, not having exposed functions deal it. know structure of struct (it's logfont ) there anyway unpack struct? i've found swig allows creating tcl interfaces c libraries. i'd rather not have ship c code access simple struct though! this kind of thing need asking product vendor about. searching doesn't turn useful information, although several posts on cadence forums seem indicate documentation need in file named " orcad_capture_tcltk_extensions.pdf ", (look in instdir /tools/capture/tclscripts/). also, _60e6d70d_p_logfont object handle. looks it's command... so, set $logfont [command_that_returns_this_handle] , , $logfont command invoke object methods, should documented in " orcad_capture_tcltk_extensions.pdf ". this sense extracted http://www.cadence.com/community/forums/p/15614/1294051.aspx . see yourself.

visual c++ - /Zm100 being set by something even though I specify /Zm200 -

i have large project i'm trying decrease build time using precompiled headers. everything works great in debug, pch size needed increased default 100 200. the problem in release, if set same additional arguments in release, following error. error c1094: '-zm100' : command line option inconsistent value used build precompiled header ('-zm200') c:\mypath\my_file.cpp does have idea -zm100 being set? here text options command line /yu"stdafx.h" /gs- /w3 /zc:wchar_t /i"../../../../source" /zi /gm /od /fd"x64\release\vc110.pdb" /fp:precise /d "win32" /d "ndebug" /d "_windows" /d "_usrdll" /d "_windll" /d "_mbcs" /errorreport:prompt /wx- /zc:forscope /gr /gd /md /fa"x64\release\" /ehsc /nologo /fo"x64\release\" /fp"x64\release\mydll.pch" when dug deeper, found our stdafx.cpp had specific setup of -zm300, when tried set -zm200 on pro...

postgresql - psql: FATAL: connection requires a valid client certificate -

Image
i trying connect postgresql server psql complaining don't have valid client certificate. here how create certificates: self-signed server certificate: openssl req -new -text -nodes -keyout server.key -out server.csr -subj '/c=us/st=california/l=fremont/o=example/ou=coredev/cn=192.168.0.100' # cn server's ip address openssl req -x509 -text -in server.csr -key server.key -out server.crt cp server.crt root.crt rm server.csr chmod og-rwx server.key client certificate: openssl req -new -nodes -keyout client.key -out client.csr -subj '/c=us/st=california/l=fremont/o=example/ou=coredev/cn=postgres' # postgres database user name openssl x509 -req -cacreateserial -in client.csr -ca root.crt -cakey server.key -out client.crt rm client.csr after copying necessary files (client.crt, client.key, root.crt) onto client machine , changing permission (i.e., chmod og-rwx client.key), following: psql 'host=192.168.0.100 port=5432 dbname=postgres user=postgres s...

php - Doctrine makes update for no reason -

when execute code doctrine changes value in database 0 although never changed value. there isn't setter-method field. the field part of id. how can doctrine changes value? edit the field belongs entity pagenamespacetranslation, field gets modified doctrine language_id . i use xml, not annotations. <entity name="exodus\domain\meta\pages\namespaces\pagenamespacetranslation" table="page_namespace_translation"> <id name="translated" association-key="true" /> <id name="language_id" type="integer" column="lang_id" /> <many-to-one target-entity="pagenamespace" field="translated" inversed-by="translations"> <join-column name="namespace_id" referenced-column-name="namespace_id" /> </many-to-one> update i think have localized problem: have entity called informationobjectaliaspagetranslation ha...

Is there a way to reload initializers automatically for rails app? -

i play railsadmin right now. railsadmin dsl configuration stored in initializers. there way keep them in model, believe it's bad idea (to store view related info in model). so, each time when have change it, have restart rails server, quite annoying. is there way enable autoreload initializers? as detailed in documentation here : in /config/initializers/rails_admin.rb should add config.parent_controller = applicationcontroller.to_s class applicationcontroller < actioncontroller::base protect_from_forgery before_filter :reload_rails_admin if :rails_admin_path? private def reload_rails_admin models = %w(user userprofile) models.each |m| railsadmin::config.reset_model(m) end railsadmin::config::actions.reset load("#{rails.root}/config/initializers/rails_admin.rb") end def rails_admin_path? controller_path =~ /rails_admin/ && rails.env == "development" end end it feel hacky , i...

Is it possible to use if -> where in MySQL? -

i have list of templates user creates data (type of data not important). templates stored in table have field private of enum type values 0, 1 means false/true. main idea each user can create private template can see him, other templates can see system users. sql should this: select `templates`.`id`, `templates`.`name`, `templates`.`description`, `templates`.`datetime`, `users`.`username` (`templates`) join `users` on `templates`.`user_id` = `users`.`id` -- -- `users`.`id` <> 1 , `templates`.`private` = 0 order `templates`.`datetime` desc limit 5 in where need rows except private not id, miss own private templates... there seems no reason join users table. can public , own private templates select `templates`.`id`, `templates`.`name`, `templates`.`description`, `templates`.`datetime`, `templates` `templates`.`user_id` = 42 or `templates`.`private` = 0 i assuming id of current user 42, substitute real...

routes - Rails: root to not having desired behavior -

i trying set root 'hello#login', render view corresponding /hello/login/ path. when go root path, after having logged out of site user, 422.html page render upon rescuing cancan accessdenied exception in event user not logged in, per following code: rescue_from cancan::accessdenied |exception| if current_user redirect_to dashboard_index_path, :notice => exception.message elsif request.env['path_info'] == '/' render :file => "#{rails.root}/public/422.html", :status => 422, :layout => true else render :file => "#{rails.root}/public/422.html", :status => 422, :layout => false end end i thought had cancan permissions, realized when manually go /home/login/ path, page displays expected without raising cancan error. believe problem routes.rb file. doesn't make sense, since basic. here routes.rb file: devise_for :users, activeadmin::devise.config activeadmin.routes...

ruby on rails - How can I prevent the odd insertion of :@new_record when cache hits in Dalli? -

i'm implementing caching on heroku using dalli , memcachier, , when cache hit it's adding symbol returned array (or hash, in different example). symbol, :@new_record, has nothing know of results i'm returning, inserted on different types of cache fetches, , haven't been able find else on so/google issue. codebase-wide find returns no results "new_record". this addition has happened in 2 places i've tried add caching. don't know how prevent happening in first place, dodge effects in particular use checking class of each record in returned set, , not rendering supplier's profile if it's not supplier. ugly solution, , i'd solve problem @ source. please let me know if have additional questions / need me post more information, , help. the method i'm using caching in: #this slow, need store somewhere def self.set_for_index(index_name) guide = index_holder[index_name] return false if guide.nil? haves, have_nots, c...

c++ - Argument conversion in the presence of function templates -

i have set of function templates depend on 2 integers. these need instantiated, except 1 of function arguments needs converted. conversion operator provided purpose. compiler (vs 2013 express preview) refuses recognize possibility of conversion. see code below. in conversion_op.h template<int n> class proxy { }; template<int m, int n> void func(const proxy<m>& p1, const proxy<n>& p2) { } typedef proxy<1> specialproxy; class orig { specialproxy p; public: operator specialproxy() const { return p; } }; in conversion_op.cpp #include "conversion_op.h" //template void func(const specialproxy&, const specialproxy&); //template void func(const specialproxy&, const proxy<2>&); //template void func(const proxy<2>&, const specialproxy&); //template void func(const proxy<2>&, const proxy<2>&); int test() { orig a; specialproxy p1; proxy...

.net - BSOD on process.start with process.getprocesses beforehand -

first, little background: i've got program acting frontend piece of lab equipment. software came lab equipment has tcp/ip interface , runs in background behind app working on. also, windows xp/visual studio 2008/.net 3.5. the problem i've got if try start oem software within program using process.start("prog-xy.exe") bsod (bug check 0xf4: critical_object_termination http://msdn.microsoft.com/en-us/library/windows/hardware/ff560372%28v=vs.85%29.aspx ). the catch bsod happens if run process.getprocessesbyname("doesn't matter string is") beforehand. (it going used find process , kill if running, before launching it) if don't run getprocessesbyname, can start process without issue. can start , kill process without repercussion windows. i tried starting program once-removed calling batch file program start oem software, it's same thing. i started new project make sure else screwey wasn't going on 3 buttons on it: 1) runs getproc...

css - How to center verticaly n inline containers with different font-size? -

Image
i discovered display: table , display: table-cell; vertical-align: middle method align divs verticaly today. i using @ many places of code, meet specific case can't make works! when want verticaly align n elements containing elements has same font-size , works fine, if want text bigger on 1 inline elements others, here happens: html: <div class="wrapper"> <div class="menu"> <div class="left"><span>left</span> </div> <div class="middle"><span>middle</span> </div> <div class="right"><span>right</span> </div> </div> </div> css: button { margin:0; padding:0; cursor:pointer; } .wrapper { height: 300px; width: 600px; background-color:red; white-space: nowrap; } .menu { height: 100%; width: 80%; } .left { height: 100%; width: 20...

ydn db - ydn-db async operation need to assign value to variable -

i'm unable assign variable async operation using callback . .done didn't assign value variable. here code : var someglobalvar = 0; dbs.count('cfs_init').done(function(x) { console.log('total : ' + x); someglobalvar = x; }); console.log(someglobalvar); // 0 your assignment works if manually (or in settimeout function) execute console.log(someglobalvar); , after receiving done callback. you executing before done callback , hence still 0 .

web applications - CORS and HTTP basic auth -

how preflighted http request if include basic auth? following conversation? im having trouble understand headers need sent where, because not possible debug firebug client: options /api/resource http/1.1 access-control-request-method: origin: http://jsconsole.com server: http/1.1 200 ok access-control-allow-origin: * access-control-allow-methods: post, get, put, delete access-control-allow-headers: authorization access-control-max-age: 1728000 access-control-allow-credentials: true client: get /api/resource http/1.1 access-control-request-method: access-control-allow-credentials: true origin: http://jsconsole.com server: http/1.1 401 unauthorized access-control-allow-origin: * access-control-allow-methods: post, get, put, delete access-control-allow-headers: authorization access-control-max-age: 1728000 access-control-allow-credentials: true www-authenticate: basic realm="authorisation required" client: get /api/resource http/1.1 access-control-allow-c...

How do I call a subfunction from another subfunction of an object in PHP? -

how call subfunction subfunction of object in php, this: class object { function function1(){ return dosomething(data); } function function3(){ function function2(){ function1(data); } } } ? i trying , error fatal error: call undefined function convertmonthstringtonumber() , convertmonthstringtonumber() being function1() in example code. you can call through $this psuedo-variable . $this->function1();

objective c - overriding property attribute in class extension -

say have interface // car.h @interface car @property ( readonly) nsinteger rpm @end i want users of access readonly in other areas private code , not exposed users want manipulate rpm say // enginefeedback.h @interface enginefeedback @property(nonatomic , weak ) car *thecar; @end // enginefeedback.m -(void) enginerpmreceived:(nsinteger) newrpm { thecar.rpm = newrpm; } how can accomplish (where need writeable) can define class extension overrides attributes // car_internal.h @interface car () @property(readwrite) nsinteger rpm @end to able use // enginefeedback.m #import "car_internal.h" -(void) enginerpmreceived:(nsinteger) newrpm { thecar.rpm = newrpm; } is bad ? there better way achieve ? using class extension override readonly property declaration fine. (in fact that's primary purpose of readonly attribute.) however, car class need provide implementation of setrpm: work @ runtime. so give...

c# - Stream UDP like TCP? -

is possible have networkstream have in tcp, in udp? i know udp doesn´t allow checks , that. but wonder if it´s possible have it, can write in stream (instead of manually having divide byte array sizes fits packages). i wondering cause nice test , experiment with. i this: var writer = new stringwriter(); writer.writeline("stuff!"); writer.writeline("things!"); ... var bytes = new asciiencoding().getbytes(writer.getstringbuilder().tostring()); _udpclient.send(bytes, bytes.length, _host, _port); on reading side can this: var bytes = _udpclient.receive(ref remoteep); var packetstring = new asciiencoding().getstring(bytes); var reader = new stringreader(packetstring); reader.readline(); // stuff! reader.readline(); // things! not streaming (in-memory byte arrays can suck if have lots of content) has worked me smallish packets. note in application it's fine if packets lost or arrive out of order. must application or else udp isn't ...

java - HTMLUnit : Determine if the "login" was successful -

i have developed script sole purpose check if website/service , running. way ,it connects page using url , logs in site using user credentials. if login successful service running fine. this script has been written in java , uses htmlunit. here lies problem. how ensure html page returned after logging in(clicking login/sign in button after filling out form) post-login "account home page".in other words how determine if login operation successful. here how doing right now. account pages have user related info. instance if log in yahoo mail have "welcome , username" on top right corner of page or page have "compose" or "inbox" on it. using logic test success. this has been observation while testing script. have come across cases rule falls apart. some times page returned after login error page asking to check entered credentials. there times page returned may ask turn on javascript or enable cookie in browser. i have come across ca...

javascript - .fadeIn() and .fadeOut() function broken? -

i'm using basic fading slide show of chris coyier's: http://css-tricks.com/snippets/jquery/simple-auto-playing-slideshow/ everything works fine, except want multiple slideshows, each being thumbnail. when added multiple of same thing, broke. noticed uses id of slideshow , , id s have unique, changed class . works, seems have broken fadein() , fadeout() functions? or @ least, that's appears have done. here's fiddle: http://jsfiddle.net/qrzke/ html : <div class="thumb" id="first"> <span><img src="http://thebarking.com/wp-content/uploads/2012/09/biscuit.jpg"></span> <div><img src="http://31.media.tumblr.com/tumblr_m33f16g9li1r21nejo1_400.jpg"></div> <div><img src="https://www.creameryschoolofmusic.com/template/upload_images/guitar-guitar-10566054-1920-1200.jpg"></div> </div> <br> <div class="thumb" id="second...

ios - For some reason the method DidBeginEditing: (UITextField *)textfield is not working -

i'm trying move view when keyboard shows wont cover screen, reason -(void)didbeginediting: (uitextfield *)textfield not working. - (void)textfielddidbeginediting:(uitextfield *)ga1 { /* should move views */ self.view.center = cgpointmake(self.view.center.x, self.view.center.y + 220); } - (void)textfielddidendediting:(uitextfield *)ga1 { /* should move views */ self.view.center = cgpointmake(self.view.center.x, self.view.center.y - 220); } its nor going method, can tell me why? in interface of class add line , in .m file put above says @implementation... @interface myclassname () <uitextfielddelegate> // properties can go here // example dragging iboutlet textfield storyboard @end you in viewdidload should set delegate of uitextfield so... -(void)viewdidload { // whatever code self.textfield.delegate = self; } alternatively, , more cleanly, can in story board control clicking text field , dragging indicator view controller class ...

iphone - Nsstring data isnt retianed after passing a controller -

my nsstring data being lost when transfer view controller 1 view controller 2 viewcontroller 3. when transfer viewcontroller 1 viewcontroller 3 works. way switching viewcontroller 1 view controller 2 causing me lose nsstring data reason. post code below, guess need in view controller 2. viewcontroller1 -(void)button{ stringentered=textfield.text; viewcontroller2 *vc2 = [[viewcontroller3 alloc] init]; vc2.string = [[nsstring stringwithstring:textfield.text] retain]; [self.navigationcontroller pushviewcontroller:vc2 animated:yes]; } viewcontroller 2 -(void)button{ viewcontroller3 *vc3 = [[viewcontroller3 alloc] init]; [self.navigationcontroller pushviewcontroller:vc3 animated:yes]; } viewcontroller3 nsstring *emailbody = [nsstring stringwithformat:@"%@",string]; in viewcontroller 3 .h file write below line @property(retain,nonatomic)nsstring *string; and synthesize in .m file @synthesize string; now in viewcontroller 2 ...

python - Pandas DataFrame Advanced Slicing -

i r user , found myself struggling bit moving python, indexing capabilities of pandas. household_id second column. sorted dataframe based on column , ran following instructions, returning various results (that expect same). expressions same? if so, why see different results? in [63]: ground_truth.columns out[63]: index([timestamp, household_id, ... (continues) in [59]: ground_truth.ix[1107177,'household_id'] out[59]: 2 in [60]: ground_truth.ix[1107177,1] out[60]: 2.0 in [61]: ground_truth.iloc[1107177,1] out[61]: 4.0 in [62]: ground_truth['household_id'][1107177] out[62]: 2 ps: cant post data unfortunately (too big). note: when sort column, you'll rearrange index, , assuming wasn't sorted way begin you'll have integers labels don't equal linear index in array. first, ix first try integers labels indices, immediate 59 , 62 same. second, if index not 0:n - 1 1107177 label, not integer index difference between 60 , 61. far float...

visual studio - How to enable /INCREMENTAL:YES for release builds with cmake on Windows -

i need use linker flag /incremental:yes when building libraries visual studio, cmake seems insist on using /incremental:no release builds, , can't figure out how fix it. of stuff i've tried is set(cmake_exe_linker_flags "/incremental:yes") set(cmake_exe_linker_flags_release "/incremental:yes") set(cmake_exe_linker_flags_init "/incremental:yes") set(cmake_exe_linker_flags_release_init "/incremental:yes") set(cmake_cxx_flags_release "/incremental:yes ${cmake_cxx_flags_release}") nothing fixes problem. far can tell, cmake plain hardwired think release build must use /incremental:no . know how fix , make use /incremental:yes ? i've check cmakecache.txt file , found more flags: cmake_module_linker_flags_release cmake_shared_linker_flags_release but can't verify assumption, seems updating cmake_exe_linker_flags_release works fine me (msvc 2012, cmake 2.8.10), /incremental:no changed /incremental . ...

sql - How to format entered date in mysql to timestamp format? -

how can format date timestamp in mysql? i have query this: select * orders order_date between('2011-01-01 00:00:00') , ('2011-01-31 23:59:59'); in table have date timestamp, if run query above doesn't show result. what want after inserting 2 dates in order_date date automatically converted timestamp this: 1334230309 so if entered format 'yyyy-mm-dd hh:mm:ss', query should run , return orders between jan 01,2011 , jan 31,2011 ok solved issue sir eric. used unix_timestamp()

eval - R evalute formulas in a list of formulas -

i have list of formulas this: ati<-list(quote(-(1/(c1 * rf) + (1/(c1 * rc) + (1/(c1 * rint) + 1/(c1 * rei))))), quote(1/(c1 * rei)), 0, quote(1/(c1 * rint)), quote(1/(c1 * rf)), quote(1/(c1 * rc)), 0, 0) list of 8 $ : language -(1/(c1 * rf) + (1/(c1 * rc) + (1/(c1 * rint) + 1/(c1 * rei)))) $ : language 1/(c1 * rei) $ : num 0 $ : language 1/(c1 * rint) $ : language 1/(c1 * rf) $ : language 1/(c1 * rc) $ : num 0 $ : num 0 i want evaluate each formula after insert value of each parameter have in other list. output want list of result. try different approach did found solution. have several of , i'd smart solution automize process. first insert value of parameters. ati list name , value list value , name of parameters stored. value<-c( 0.110546010137993, 9.95953827321208, 7.1751380374394, 285.658095052437, 285.967649817749) names(value)<-c( "c1", "rc", "rei", "rf", "rint") ati<-gsub(...

shell - Print the difference between 2 timetamps in a file unix -

cat row1col1 row1col2 2013-08-26 22:07:26 2013-08-26 22:07:26 row2col1 row2col2 2013-08-26 22:08:16 2013-08-26 22:08:20 (2 rows) the objective capture rows have difference of greater 3 seconds between timestamps. output here row2col1 row2col2 2013-08-26 22:08:16 2013-08-26 22:08:20 tried below. bash-3.2$ echo $d1 08/28/2013 16:56:36 bash-3.2$ echo $d2 08/28/2013 16:56:44 bash-3.2$ date1=$(date -d "$d1" +%s) bash-3.2$ date2=$(date -d "$d2" +%s) bash-3.2$ diff=$(expr $date2 - $date1) bash-3.2$ echo $diff 8 getting syntax error "%s" while using awk command. here 2 variations tried.but awk '{t1=$3" "$4;t2=$5" "$6;time2=$(date -d "$t2" +%s);time1=$(date -d "$t1" +%s); if ($(expr $time2 - $time1) > 3) print $0 }' awk has built-in mktime() ...

jquery mobile - Keep Google Maps from reloading in JqueryMobile page -

i'm using google maps api in jquerymobile/phonegap project. if go map "page" , change zoom level, drag map around, etc , navigate away , map page doesnt save state, reloads map. have tried using dom-cache <div data-role="page" id="map" data-dom-cache="true"> didn't seem @ all. how can save map "state" , avoid reload when navigating away , back? requested code <div data-role="page" id="map" data-dom-cache="true"> <div data-role="header" data-theme="e"> <h1>honeyspot</h1> </div> <div data-role="content" style="width:100%; height:100%; padding:0;"> <div id="map_canvas" style="width:100%;height:100%"></div> </div> <div data-role="footer" data-theme="a" data-id="ma...