Sunday 15 July 2012

Link error while compiling llvm with a new optimization pass -



Link error while compiling llvm with a new optimization pass -

i have written new llvm optimization pass. have added pass making new directory @ next location: llvm/lib/transform/addsub

i next steps mentioned in llvm documentation: http://llvm.org/docs/writinganllvmpass.html

but while compiling getting linking errors. may build , makefile settings not correct.

relocation r_x86_64_pc32 against undefined symbol `_ztvn12_global__n_18addsube' can not used when making shared object; recompile -fpic

if have written independent llvm pass , added in new directory within llvm at: llvm/lib/transform/

what makefile or build changes need create while writing independent pass?

i ran same error when trying follow writing llvm pass guide. me, prepare adding line this:

char mypassname::id = 0;

(i had skipped on step in directions.)

llvm llvm-ir

python - Pythonic switching using functions inside a class -



python - Pythonic switching using functions inside a class -

i attempting utilize dict command function selection within class, however, next typeerror:

typeerror: a() missing 1 required positional argument: 'self'

example code:

class tt: def __init__(self): pass def a(self): print("a") def b(self): print("b") def c(self): print("c") a_diction={ '0' : a, '1' : b, '2' : c } def ad(self,data): self.a_diction[data]()

how should build switch in ad provide self both a_diction , called method a, b , c?

the error message indicates you're missing argument. suggest adding argument.

self.a_diction[data](self)

python class switch-statement

nest api target temperature for both thermostat modes -



nest api target temperature for both thermostat modes -

is possible fetch target temperature both thermostat mode (cool, heat) in 1 phone call ? have feeling can target temperature current thermostat mode , alter thermostat mode sec 1 , target temperature sec thermostat mode.

also same question changing target temps. possible alter both target temperature heat , cool mode in 1 request ?

assuming scheme can cool , heat, thermostat has 3 modes: heat, cool, heat-cool.

if in heat mode or cool mode can set target_temperature. if in heat-cool mode can set target_temperature_low_c & target_temperature_high_c.

you can retrieve target temperatures in 1 thermostat call:

https://developer-api.nest.com/devices/thermostats/$thermostat_id?auth=$auth

you can set heat-cool temperatures in 1 call, need in heat-cool mode:

{"target_temperature_low_c": 19, "target_temperature_high_c": 21}

you can set heat or cool temperature in 1 call, need in heat or cool mode:

{"target_temperature_c": 20}

you need create 2 calls set mode , set temperature(s) if not in appropriate mode.

target temperature nest-api

ruby - Display an icon before text in a QTreeView -



ruby - Display an icon before text in a QTreeView -

i'm using qtruby qt 4.8.6 , trying create tree view each item has custom icon between tree controls , name. end result should this:                      

i getting space allocated icon should go, i'm not seeing icons. have them show up?                      

here's code (simplified remove no-data border cases):

class="lang-ruby prettyprint-override">class mymodel < qt::abstractitemmodel # ... def data(index, role) case role when qt::displayrole case index.column when 0; qt::variant.new(index.internalpointer.displayname) when 1; qt::variant.new(index.internalpointer.displaytype) end when qt::decorationrole if index.column==0 # testing show static icon items qt::pixmap.new(':/resources/images/objects-scene-normal.png') end end end end @mytreeview.model = mymodel.new

if want inspect qt designer .ui file (in case tree view needs have property set have not) can seen here.

i think image cannot found path specified. verify qfileinfo::exists().

ruby qt treeview qtreeview qtruby

android - Using Umano SlidingUpPanel with limited drag area and drag button -



android - Using Umano SlidingUpPanel with limited drag area and drag button -

i'm using umano slidinguppanel 1 of test project have 1 problem wherein wanted create panel expand when press (not click) , drag image or when click button expand. later bit easy implement press i'm having hard time implement it.

for improve visual here xml panel:

<com.sothree.slidinguppanel.slidinguppanellayout xmlns:sothree="http://schemas.android.com/apk/res-auto" android:id="@+id/sliding_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="bottom" android:background="#00ffffff" sothree:panelheight="120dp" sothree:shadowheight="0dp" sothree:overlay="true" sothree:fadecolor="@android:color/transparent"> <relativelayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <imageview android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/imageview2" android:src="@drawable/test_img" android:adjustviewbounds="true" android:scaletype="centercrop" /> <imageview android:layout_width="40dp" android:layout_height="40dp" android:id="@+id/ic_menu" android:src="@drawable/menu" android:layout_marginleft="5dp" android:layout_margintop="5dp" android:onclick="showdrawer" /> </relativelayout> <linearlayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="match_parent" android:background="#00ffffff"> <linearlayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="50dp" android:background="#00ffffff" android:id="@+id/transparent_panel"> <imageview android:layout_width="40dp" android:layout_height="40dp" android:id="@+id/ic_menu2" android:layout_marginleft="5dp" android:layout_margintop="5dp" android:onclick="showdrawer" android:visibility="gone" android:src="#00ffffff" /> <linearlayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center"> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/img_expand" android:src="@drawable/img_expand" /> </linearlayout> </linearlayout> <linearlayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#66ffffff" android:id="@+id/pager_container"> <android.support.v4.view.viewpager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" > <android.support.v4.view.pagertitlestrip android:id="@+id/pager_title" android:background="@color/yellow" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="top"/> </android.support.v4.view.viewpager> </linearlayout> </linearlayout> </com.sothree.slidinguppanel.slidinguppanellayout>

here have panel image wanted handle when expanding drawer , on code tried implement this:

imageview img_expand = (imageview) findviewbyid(r.id.img_expand); slidelayout = (slidinguppanellayout) findviewbyid(r.id.sliding_layout); slidelayout.setslidingenabled(false); img_expand.setontouchlistener(new view.ontouchlistener() { @override public boolean ontouch(view v, motionevent event) { log.e("test", string.valueof(event)); log.e("test2", string.valueof(event.action_down)); log.e("test3", string.valueof(event.getaction())); log.e("test4", string.valueof(motionevent.action_down)); log.e("test5", string.valueof(motionevent.action_move)); if (event.getaction() == motionevent.action_move || event.getaction() == motionevent.action_down) { slidelayout.setslidingenabled(true); homecoming true; }else{ slidelayout.setslidingenabled(false); homecoming false; } } });

sadly didn't work expected. hope can guide me on this. :d

android

callback - Set default value for field using model method in rails 3 -



callback - Set default value for field using model method in rails 3 -

i have table called enrollments , have column on table called last_taken :datetime. using rails 3.2

i had constraint on database set field time.now of course of study set default time of migration. want set default value in model. looking on site solution seems callback, have tried in several forms. not working:

after_initialize :set_last_taken def set_last_taken self.last_taken ||= time.zone.now end

no matter callback utilize (i.e. before_create, before_save) value of nil when create field in console without setting field. console shows like:

1.9.3p194 :052 > enrollment.create(user_id: 22, course_id: 8) (0.3ms) begin enrollment exists (0.7ms) select 1 1 "enrollments" ("enrollments"."user_id" = 22 , "enrollments"."course_id" = 8) limit 1 sql (1.1ms) insert "enrollments" ("course_id", "created_at", "last_taken", "role", "updated_at", "user_id") values ($1, $2, $3, $4, $5, $6) returning "id" [["course_id", 8], ["created_at", sat, 11 oct 2014 14:56:53 eest +03:00], ["last_taken", nil], ["role", "user"], ["updated_at", sat, 11 oct 2014 14:56:53 eest +03:00], ["user_id", 22]] (0.8ms) commit => #<enrollment id: 108, user_id: 22, course_id: 8, created_at: "2014-10-11 11:56:53", updated_at: "2014-10-11 11:56:53", role: "user", last_taken: nil>

after_initialize should work. please write on after initialize method , check output.

after_initialize :set_last_taken def set_last_taken logger.debug("@@@@ - after initialize called") end

please check database column type , attr_accessible field.

model callback ruby-on-rails-3.2 rails-activerecord

javascript - pareser error while sending data as json to php script using jquery ajax -



javascript - pareser error while sending data as json to php script using jquery ajax -

i'm sending info sever @ localhost using jquery's $.ajax.

the info json object.

as follows:

javascript

var jso={ "data": { "game_name": "road rash", "cheat": "xyzzyspoon!", "effects": [ { "nitro": true }, { "chain": false } ] } }; function senddata(){ var querystring=json.stringify(jso); $.ajax({ type: "post", url: "/gamers_cheats.php", contenttype: "application/json; charset=utf-8", traditional: true, datatype: 'json', data: querystring, success: function(data){ console.log(data); }, error: function(data,textstatus,jqxhr){ alert("unknown error occured :- \n "+textstatus+"\n error"); console.log("unknown error occured :- \n "+textstatus+"\n error"); } }); } senddata();

and handling info in php file as:

gamers_cheats.php:

<?php var_dump($_post); echo"\n count:- ".count($_post); // demo file ?>

but problem $.ajax alerts error: part textstatus parsererror. same happening if didn't utilize json.stringify.

and if lines:

contenttype: "application/json; charset=utf-8", traditional: true, datatype: 'json',

were removed request sent sever isn't valid request adds slashes (\) every (") in json object.

like:

\"data\": { \"game_name\": \"road rash\", \"cheat\": \"xyzzyspoon!\", \"effects\": [ { \"nitro\": true }, { \"chain\": false } ] }

so gives error while processing on server side. there way send post json info using jquery ajax , handle on server?

and 1 more question, can add together $_post parameters not in json format querystring data: querystring +"&&navigator="+navigator.useragent+"" ? ain't working (this not of import though, curious it).

fyi i'm running iis 7 server php 5.2 , jquery version 1.7.2 json2.js .

hope experts here help me.

removing line 'var querystring=json.stringify(jso);' , passing object jso info may help. seek once.

javascript php jquery ajax json

ios - Xib to Storyboard issue in copying -



ios - Xib to Storyboard issue in copying -

i migrated xibs storyboard in xcode 6. this, created new controller in storyboard, deleted view in storyboard, selected , copied whole view hierarchy in controller's xib , pasted storyboard.

i had manually remap outlets in storyboard , works.

the problem can not see of views in storyboard, , can not add together new subviews. see name of controller , thats (see image).

how around ?

ios xcode xcode6 uistoryboard xib

html - why is @font-face not working -



html - why is @font-face not working -

i have extremely frustrating problem. trying install font website building font not seem want work. have of different font formats different browsers. code below.

a live link of website can found here, future users shall removing question answered

css font

<style> @font-face { font-family: 'myfamily'; src: url('segoeuil.eot'); src: url('segoeuil.eot?#iefix') format('embedded-opentype'), url('segoeuil.woff2') format('woff2'), url('segoeuil.woff') format('woff'), url('segoeuil.ttf') format('truetype'), url('segoeuil.svg#segoe_uilight') format('svg'); font-weight: normal; font-style: normal; }

html code

<ul class="bxslider"> <li style="background-image: url(images/slide1.png);"><div style="text-align: center;"> <div> <h1 style="font-family: 'segoe ui light'">we blah blah blah</h1> </div><h2>we blah blah blah.</h2> </div> <div id="apdiv2"></div> </li> <li style="background-image: url(images/slide2.png);"></li> <li style="background-image: url(images/slide3.png);;"></li> <li style="background-image: url(images/slide4.png);"></li> <li style="background-image: url(images/slide5.png);"></li> </ul>

in css give font-family name (font-family: 'myfamily';), in html trying target font different name... right code create work is:

@font-face { font-family: 'myfamily'; src: url('segoeuil.eot'); src: url('segoeuil.eot?#iefix') format('embedded-opentype'), url('segoeuil.woff2') format('woff2'), url('segoeuil.woff') format('woff'), url('segoeuil.ttf') format('truetype'), url('segoeuil.svg#segoe_uilight') format('svg'); font-weight: normal; font-style: normal; }

and then

<ul class="bxslider"> <li style="background-image: url(images/slide1.png);"><div style="text-align: center;"> <div> <h1 style="font-family: 'myfamily'">we blah blah blah</h1> </div><h2>we blah blah blah.</h2> </div> <div id="apdiv2"></div> </li> <li style="background-image: url(images/slide2.png);"></li> <li style="background-image: url(images/slide3.png);;"></li> <li style="background-image: url(images/slide4.png);"></li> <li style="background-image: url(images/slide5.png);"></li> </ul>

html css fonts font-face

file upload - h:inputFile not displaying in xhtml page with jsf 2.2 -



file upload - h:inputFile not displaying in xhtml page with jsf 2.2 -

h:inputfile not getting displayed in page. here jsf code

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://xmlns.jcp.org/jsf/html"> <h:head> </h:head> <h:body> <h:form> <h:inputfile></h:inputfile> </h:form> </h:body> </html>

actually changed namespace from

<xmlns:h="http://java.sun.com/jsf/html">

to <xmlns:h="http://xmlns.jcp.org/jsf/html">

by seeing previous problems in forums changed namespace none of ui components getting displayed including h:inputfile

i added these jar files also

jsf-impl-2.2.4 jsf-api-2.2.4

my web.xml looks this

<?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="webapp_id" version="3.0"> <display-name>jsfeaxmples</display-name> <context-param> <param-name>javax.faces.state_saving_method</param-name> <param-value>server</param-value> </context-param> <context-param> <param-name>javax.faces.default_suffix</param-name> <param-value>.xhtml</param-value> </context-param> <context-param> <param-name>javax.faces.project_stage</param-name> <param-value>development</param-value> </context-param> <context-param> <param-name>javax.faces.facelets_refresh_period</param-name> <param-value>1</param-value> </context-param> <context-param> <param-name>javax.faces.facelets_skip_comments</param-name> <param-value>true</param-value> </context-param> <context-param> <param-name>javax.faces.separator_char</param-name> <param-value>-</param-value> </context-param> <context-param> <param-name>org.richfaces.skin</param-name> <param-value>classic</param-value> </context-param> <context-param> <param-name>facelets.build_before_restore</param-name> <param-value>true</param-value> </context-param> <context-param> <param-name>facelets.recreate_value_expression_on_build_before_restore</param-name> <param-value>true</param-value> </context-param> <servlet> <servlet-name>faces servlet</servlet-name> <servlet-class>javax.faces.webapp.facesservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>faces servlet</servlet-name> <url-pattern>*.jsf</url-pattern> <url-pattern>*.xhtml</url-pattern> </servlet-mapping> <context-param> <param-name>javax.servlet.jsp.jstl.fmt.localizationcontext</param-name> <param-value>resources.application</param-value> </context-param> <listener> <listener-class>com.sun.faces.config.configurelistener</listener-class> </listener> </web-app>

but still not getting displayed can 1 help me? in advance

jsf file-upload jsf-2.2

sql - Join table index performance improvements concerns -



sql - Join table index performance improvements concerns -

to start with, have 3 tables, primary key , other data. these tables joined in bring together table ~70 1000000 rows: table_1, table_2, table_3.

there primary key in bring together table across table_3_id, table_1_id, table_2_id (in order). there non-clustered index on table_1_id, table_2_id, table_3_id (in order) fill index of 95.

the info filtered table_1_id (i have preset of ~100 of these ids) , (through join) property table_3 (so uses table_3_id). then, table_1_id , table_2_id values returned. done in 1 query in entity framework.

this query:

var items = datacontext.tablesjoin.asnotracking() .join(datacontext.table_3.asnotracking(), x => x.table_3_id, x => x.id, (combi, scan) => new { combi, scan }) .where(x => possibleids.contains(x.combi.table_1_id) && otherids.contains(x.scan.other_id)) .select(x => new { firstid = x.combi.table_1_id, secondid = x.combi.deviceinformationdevices_id }) tolist();

because configuration running on sql server express, i'm running space problems (10gb max). info 2gb, primary key , index total of 5gb. because there more info in database, i'm interested in reducing size of index while retaining performance.

after looking @ everything, had concerns used. because of of bring together i'm not exclusively sure how useful include table_3_id in non-clustered index. removing column index saves around 1gb of space.

initially, had table clustered index (to safe space) because table has quite amount of inserts (1000 / hour) slow because of disk access had swap 10gb of info around. help if fill factor set lower (like 70) around this? of course, mean more wasted space if save lot on index might worth it?

this table used lot , performance index needed. running without index takes few minutes execute, whereas index done within 2 seconds.

execution plan xml: http://pastebin.com/raw.php?i=tfuxgyrk

you don't need primary key uniqueness. nci provides uniqueness. can rid of 1 of indexes. should save space.

you can save space other index uses making clustered. notices performance problems due to, apparently, randomly located inserts. plausible. consider changing column order of index inserts happen in 1 or few places. way pages affected tend cached. working set required dml low.

the dml perf problems not due page splits. these cause cpu load , fragmentation. perf problems because random pages must read disk.

1000 inserts per hr not lot. consider accumulating writes delta table little , cached. move rows on main table in background process. way dml latency off critical path. selects either need tolerate staleness or union all delta table.

sql sql-server entity-framework join indexing

javascript - Masonry plugin returning error when used with Infinite Scroll in tumblr -



javascript - Masonry plugin returning error when used with Infinite Scroll in tumblr -

i know alot has been written this, sense close solving issue.

i trying utilize theme has masonry installed, client asking infinite scroll , causing me issues.

initially seeing errors in console both masonry , infinite scroll plugins, @ to the lowest degree seeing masonry error. , though infinite scroll function calling subsequent pages of posts, it's masonry struggling append them page in right layout.

i think callback function, worried may need phone call imagesloaded function (this plugin called via theme).

i have re-create of current theme here: http://kod-temp.tumblr.com/

the inline script looks this:

var $wall = $('#posts'); $(window).load(function () { // grid $wall.masonry({ columnwidth: 84, itemselector: '.post:visible' }); // infinite scroll $('#posts').infinitescroll({ navselector : ".pagination", // selector paged navigation (it hidden) nextselector : ".pagination a:first", // selector next link (to page 2) itemselector : "#posts .post" // selector items you'll retrieve }, // trigger masonry callback function( newelements ) { var $newelems = $( newelements ); $wall.masonry( 'appended', $newelems ); } );

the markup follows simple block this:

<div id="posts"> <article class="post"></div> </div>

the error is:

uncaught typeerror: undefined not function masonry.js:10

(http://static.tumblr.com/qlf79cn/tgeleg9g0/masonry.js)

well have working code on this. js looks this:

(function () { var $tumblelog = $('#posts'); $tumblelog.infinitescroll({ navselector: ".pagination", nextselector: ".pagination a:last-child", itemselector: "article", }, function (newelements) { var $newelems = $(newelements).css({ opacity: 0 }); $newelems.imagesloaded(function(){ $newelems.animate({ opacity: 1 }); $tumblelog.masonry('appended', $newelems); }); }); $tumblelog.imagesloaded(function(){ $tumblelog.masonry({ columnwidth: 84 }); }); })();

the imagesloaded script required (as question has been raised me here).

javascript jquery infinite-scroll masonry

mysql - Copying One column from table to another table that has matching variables in another column -



mysql - Copying One column from table to another table that has matching variables in another column -

i hope can explain create sense lol.

i trying re-create variables 1 hats_old.red hats_new.red match hats_new.name in both tables, if not match need nil not null value or set 0.

this far ive gotten. changes unmatched 0 trying avoid , cannot figure rest out. mysql

thank you

update hats_new set hats_new.red = ( select hats_old.red hats_old hats_old.name = hats_new.name limit 1 );

an update join should trick:

update hats_new hn bring together hats_old ho on hn.name = oh.name set hn.red = ho.red

mysql multiple-columns copying exact-match

c# - Server Error Can't Resolve System.Web.Mvc Components -



c# - Server Error Can't Resolve System.Web.Mvc Components -

i have asp.net mvc project on local machine target .net 4.0 , works perfectly. has. i've been deploying app production server no problems long time well. of sudden, despite fact can build on machine, when building in production machine on 100 errors, missing references:

the type or namespace name 'httppost' not found (are missing using directive or assembly reference?)

all of these missing references system.web.mvc dll. can't figure out why of sudden it's not working. i've tried setting dll re-create local no avail. there may missing causing mvc reference not work?

you're referencing system.web.mvc version dll 4.0 instead of 4.5. check reference that, , if it's wrong, remove , re-add right version

go setting of system.web.mvc reference true (copy local = true)

copy local of import deployment scenarios , tools. general rule should utilize copylocal=true if reference not contained within gac.

copy local means must manually deploy dll in order application work. when it's false means "you depend on component must installed separately or chained, dll there already".

to set re-create local property true or false

c# asp.net .net asp.net-mvc asp.net-mvc-4

How do I detect if adblock is preventing "Signin with Facebook" in nopcommerce? -



How do I detect if adblock is preventing "Signin with Facebook" in nopcommerce? -

i'm using signin facebook plugin nopcommerce here:

http://favalife.azurewebsites.net/login

i noticed in chrome, facebook button doesn't appear if adblock running.

what can create front-end "better" or more functional , allow facebook logins while adblock hiding image, and/or next code:

<a href="/plugins/externalauthfacebook/login?returnurl=%2fcart" class="facebook-btn"> &nbsp;</a>

you can add together apporpriate styles \plugins\externalauth.facebook\content\facebookstyles.css file

facebook nopcommerce adblock

java - jBPM6 trying to use previously completed Process Instance Id -



java - jBPM6 trying to use previously completed Process Instance Id -

environment : jbpm 6.0.1.final, jboss eap 6.2.0, jdk 7 i'm using runtimemanager of per process instance follows

runtimemanagerfactory.factory.get().newperprocessinstanceruntimemanager(runtimeenvironment, identifier);

and starting process instance next piece of code

public long startprocesswithinitialparametersandfirebusinessrules(string processname, map<string, object> parametermap) { runtimeengine runtimeengine = manager.getruntimeengine(processinstanceidcontext.get()); kiesession ksession = runtimeengine.getkiesession(); processinstance processinstance = ksession.startprocess(processname, parametermap); long processinstanceid = processinstance.getid(); ksession.fireallrules(); homecoming processinstanceid; }

this configuration works day configured. next day tried create new instance of process using application. application throws exception , process not instantiated. next stacktrace of it.

(http-/127.0.0.1:8080-1) error handled leave approver :: org.jbpm.services.task.exception.permissiondeniedexception: user '[userimpl:'tester']' unable execution operation 'start' on task id 142 due no 'current status' match @ org.jbpm.services.task.internals.lifecycle.mvellifecyclemanager.evalcommand(mvellifecyclemanager.java:128) [jbpm-human-task-core-6.0.1.final.jar:6.0.1.final] @ org.jbpm.services.task.internals.lifecycle.mvellifecyclemanager.taskoperation(mvellifecyclemanager.java:318) [jbpm-human-task-core-6.0.1.final.jar:6.0.1.final] @ org.jbpm.services.task.identity.usergrouplifecyclemanagerdecorator.taskoperation(usergrouplifecyclemanagerdecorator.java:46) [jbpm-human-task-core-6.0.1.final.jar:6.0.1.final] @ or

with same process instance id, yesterday created process , completed. same process instance id trying utilize jbpm6 today when trying instantiate new process , due it's status completed not matching, throwed exception.

why trying utilize completed task's process instance id or created process instance id , how can alter it's behaviour ?

as per observation, happening due new process creation time, picking old process instance id , returning task record.

please help solve problem. tried googling, couldn't find proper documentation of it.

update: click here

java file start process, submit task, , terminate task done in above file. please check more clarity.

unfortunately it's hard figure out what's going on based on details provided. error states task id 142 cannot started user 'tester'. why believe using old process instance or task id? how trying start task, share code?

java jboss jbpm

c - Can I rely on the include guards in standard headers -



c - Can I rely on the include guards in standard headers -

i want know if can rely on particular definitions of include guards in standard headers. if on scheme visual studio can see, example, stdint.h has _stdint defined. question if can rely on #define other compilers too. basically, safe me this:

#ifndef _stdint typedef char int8_t; #endif

i know might stupid. why not include stdint.h say? i'm writing code may deployed embedded targets, might not happy including standard c headers. however, want able utilize them when available. therefore, want able take in file has int main() whether want include stdint.h or not.

you can rely on standard library header declare (and no more than) specified declare. means that:

if feature optional, standard specify feature-test macro can check #if or #ifdef, tell if available on platform. e.g. threads.h optional in c11, standard specifies __stdc_no_threads__ defined 1 if header not available.

if feature not optional, should able assume present! if isn't present, compiler isn't conforming language version, , you'd improve hope stuff explicitly spelled out in documentation, because you're implementation-defined territory.

many features provided macros, or associated macro definitions; can hence test existence of such features independent of whole header.

so case of stdint.h, there no feature test macro provided because header not optional. if isn't present, compiler ought documenting that, , not claiming standard compliance. however, features within stdint.h optional, , hence testable individually associated macros.

for instance, exact-width integer types described in 7.20 (int8_t , on) require associated macro definitions describing maximum , minimum values (and these macros not defined if types not available), can test specific availability of int8_t testing whether int8_max defined after including header.

c include-guards

html - No route matches {:action=>"search", :controller=>"devise/index"} -



html - No route matches {:action=>"search", :controller=>"devise/index"} -

i'm having problem research routes. accuse error:

actioncontroller::urlgenerationerror in devise::sessions#new no route matches {:action=>"search", :controller=>"devise/index"}

my application:

<!doctype html> <html> <head> <title>javendi</title> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> <%= csrf_meta_tags %> </head> <body> <div class = 'search', style="display:none"> <%= form_for root_path, :url => {:action => 'search', :controller=>"index"} |f|%> <%= text_field_tag "ad[price_min]", @ads_min, :placeholder => 'price min', class: 'price' %> <%= text_field_tag "ad[price_max]", @ads_max, :placeholder => 'price max', class: 'price' %><br> <%= text_field_tag "ad[title]", @ads_text, :placeholder => 'ad name', class: 'titlesearch' %><br> <div class='categorysearch'> <%= collection_select :ad, :category_id, category.all,:id,:name,:prompt => true, :selected => @ads_category_id %> <br></div> <%= f.submit'searc', class: 'bottomsearch' %> <%end%> </div> <div class="cima"> <!-- <a href="https://www.google.com.br/?gfe_rd=cr&ei=hnnovnvjnyim8aab2ihocw&gws_rd=ssl"><img src="assets/2.gif" border="0" onmouseover="this.src='assets/7.gif'" onmouseout="this.src='assets/2.gif'"></a> --> <div class= 'logout'> <% if user_signed_in? %> <%= link_to image_tag('exit.png', width: '50px', height:'50px'),destroy_user_session_path, method: :delete %> <%else%> <%end%> </div> <div class= "home"> <%= link_to image_tag('logo.png'),root_path %> </div> <div class="javendi"> <% if user_signed_in? %> <button class= 'botton1'> <%= link_to 'editar perfil', edit_user_registration_path %>| <%= link_to 'novo anúncio', new_ad_path %>| <%= link_to 'meus anúncios', my_ads_path %>| <%= link_to 'meus favoritos', fav_ads_path %> </button> <%else%> <button class= 'botton'> <%= link_to 'cadastre-se', new_user_registration_path %> | <%= link_to 'login', new_user_session_path %> </button> <%end%> <div class='triangule'> <div class="seta-cima"> </div> </div> </div> <% if user_signed_in? %> <div id='iconsearh2'> <%= image_tag("search.png") %> </div> <%else%> <div id='iconsearh'> <%= image_tag("search.png") %> </div> <%end%> </div> <script type="text/javascript"> $('#iconsearh').click(function(){ if($('.search').is(':visible')){ $('.search').slideup('fast') $('.seta-cima').css("display","none"); }else{ $('.search').slidedown('fast') $('.seta-cima').show(); } }); </script> <script type="text/javascript"> $('#iconsearh2').click(function(){ if($('.search').is(':visible')){ $('.search').slideup('fast') $('.seta-cima').css("display","none"); }else{ $('.search').slidedown('fast') $('.seta-cima').show(); } }); </script> <div class='cima2'> <div class='welcome'> <% if current_user.present?%> welcome <%=current_user.name%> <%end%> </div> <div class= 'createad'> <%= image_tag('7.gif', width: '50px', height:'50px')%> </div> </div> <div class="results"> <%= yield %> </div> <div class= "bot"> &nbsp </div> </div> </body> </html>

my ads model:

class advertisement < activerecord::base validates_presence_of :title, message: "deve ser preenchido" validates_presence_of :price, message: "deve ser preenchido" validates_presence_of :adress, message: "deve ser preenchido" validates_presence_of :email, message: "deve ser preenchido" validates_presence_of :phone, message: "deve ser preenchido" belongs_to :user belongs_to :category has_many :photos, :dependent => :destroy accepts_nested_attributes_for :photos, :allow_destroy => true has_many :user_ad_favs def can_edit?(current_user) if current_user.present? homecoming current_user.id == self.user_id end end def self.search(query) category = query[:category_id].present? ? "category_id = #{query[:category_id]}" : nil title = query[:title].present? ? "title '%#{query[:title]}%'" : nil price_min = query[:price_min].present? ? "price >= #{query[:price_min].to_f}" : nil price_max = query[:price_max].present? ? "price <= #{query[:price_max].to_f}" : nil query = [category, title, price_min, price_max].compact.join(" , ") homecoming ad.where ( query ) end def user_fav(user) homecoming self.user_ad_favs.find_by_user_id_and_ad_id(user.id, self.id) end end

my ads controller:

class adscontroller < applicationcontroller before_action :set_ad, only: [:show, :edit, :update, :destroy, :fav_ad,:unfav_ad, :search,] # /ads # /ads.json def index @ads = ad.all end # /ads/1 # /ads/1.json def show end # /ads/new def new @ad = current_user.ads.build 1.times { @ad.photos.build} end # /ads/1/edit def edit end def search @ads_min = params[:ad][:price_min] @ads_max = params[:ad][:price_max] @ads_title = params[:ad][:title] @ads_category_id = params[:ad][:category_id] @ads = ad.search(params[:ad]) render :action => 'index' end # post /ads # post /ads.json def create @ad = current_user.ads.build(ad_params) respond_to |format| if @ad.save format.html { redirect_to @ad, notice: 'ad created.' } format.json { render :show, status: :created, location: @ad } else format.html { render :new } format.json { render json: @ad.errors, status: :unprocessable_entity } end end end # patch/put /ads/1 # patch/put /ads/1.json def update respond_to |format| if @ad.update(ad_params) format.html { redirect_to @ad, notice: 'ad updated.' } format.json { render :show, status: :ok, location: @ad } else format.html { render :edit } format.json { render json: @ad.errors, status: :unprocessable_entity } end end end # delete /ads/1 # delete /ads/1.json def destroy @ad.destroy respond_to |format| format.html { redirect_to ads_url, notice: 'ad destroyed.' } format.json { head :no_content } end end def fav_ad user_ad_fav = @ad.user_fav(current_user) if user_ad_fav.present? user_ad_fav.update_attribute(:fav, true) else @ad.user_ad_favs.create(:user_id => current_user.id,:ad_id => @ad.id,:fav => true) end respond_to |format| format.js {render inline: "location.reload();"} end end def unfav_ad @ad.user_fav(current_user).update_attribute(:fav, false) if @ad.user_fav(current_user).present? respond_to |format| format.js {render inline: "location.reload();"} end end private # utilize callbacks share mutual setup or constraints between actions. def set_ad @ad = ad.find(params[:id]) end # never trust parameters scary internet, allow white list through. def ad_params params.require(:ad).permit(:title, :price, :adress, :city, :state, :description, :email, :phone, :phone_type, :category_id, :photos_attributes =>[:photo]) end end

you made error in :controller parameter in form_for:

<%= form_for root_path, :url => {:action => 'search', :controller=>"index"} |f|%>

first of all, :controller should 'ads' since search action in adscontroller provided sample of.

second, you're using form_for wrong. you're passing in 2 different paths, root_path , :url hash. first parameter should model you're trying create form for. don't need here, want search form, utilize form_tag instead:

<%= form_tag :action => 'search', :controller=>"ads" %>

http://api.rubyonrails.org/classes/actionview/helpers/formtaghelper.html#method-i-form_tag

html ruby-on-rails devise

android - AsynkTask returning null on method -



android - AsynkTask returning null on method -

the problem method doinbackground homecoming 0 onpostexecute , tried lot dind't how prepare , please help

@override protected string doinbackground(string... params) { makecount(url_orders_us,count); homecoming null; }

here method

public void makecount(string uri,int countnow){ list<namevaluepair> paramus = new arraylist<namevaluepair>(); jsonobject json = jsonparser.makehttprequest(uri, "get", paramus, savedtoken); seek { jsonobject info = json.getjsonobject("data"); jsonobject orders = data.getjsonobject("orders"); iterator<string> orderiterator = orders.keys(); while (orderiterator.hasnext()) { try{ jsonobject c = orders.getjsonobject(orderiterator.next()); countnow++; } catch(exception e){ e.printstacktrace(); } } }catch (jsonexception e){e.printstacktrace();} }

and onpostexecute

@override protected void onpostexecute(string s) { usac.settext(string.valueof(count)); pdialog.dismiss(); }

countnow passed value of other parameter in java. declare fellow member of asynctask cuatom class u've created because you're modifying local re-create , not global behaviour u want achieve

android android-asynctask

I have couple of questions.....in android and android fragments -



I have couple of questions.....in android and android fragments -

how gmail confirmation whenever send mail service in android app programmatically(in ios possible )?

i have tried confirmation android app

private void sendviaemail() { seek { final intent emailintent = new intent(android.content.intent.action_send); emailintent.settype("text/plain"); emailintent.putextra(intent.extra_email, new string[]{""}); emailintent.setclassname("com.google.android.gm", "com.google.android.gm.composeactivitygmail"); emailintent.putextra(intent.extra_subject, issue.gettext()); emailintent.putextra(intent.extra_text, description.gettext()); startactivityforresult(emailintent,2); // saveinfotodatabase(); } grab (exception e) { toast.maketext(getapplicationcontext(), "email faild, please seek 1 time again later!", toast.length_long).show(); e.printstacktrace(); } }

the above method navigating our app gmail composer page. here dont know whether sent or not? there posiblity

i worked on fragments in android, , when navigating 1 fragment fragment using replace(),addtobackstack(null). if utilize replace() without addtobackstack(null), next fragment ui overlapped current fragment ui. why happened? gone through plenty of stack overflow questions failed reason why happened.

i have written next code

accountsettingsbtn.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { fragment fragment = new accountsettingsfragment(); fragmentmanager fragmentmanager = getactivity().getsupportfragmentmanager(); fragmenttransaction fragmenttransaction = fragmentmanager.begintransaction(); // ((homescreenactivity)getactivity()).addfragmenttolist(fragment); fragmenttransaction.replace(r.id.home_frame, fragment); fragmenttransaction.addtobackstack(null); fragmenttransaction.commit(); } });

android android-fragments

javascript - Building table dynamically with PDFMake -



javascript - Building table dynamically with PDFMake -

i'm working pdfmake generate pdf javascript. i'm trying build table dynamically not works ,this attempt

class="lang-js prettyprint-override">$.ajax({ type: "post", url: myurl, success:function(data){ /* info has format : *[{"peaje":"peaje 1","ruta":"ruta 1","fechacruce":"2014-10-18","hora":"15:42","valor":"5000"},{"peaje":"peaje 1","ruta":"ruta 1","fechacruce":"2014-10-18","hora":"14:21","valor":"7000"},{"peaje":"peaje 1","ruta":"ruta 1","fechacruce":"2014-09-19","hora":"11:58","valor":"17000"}] */ var peajes = json.parse( info ); var body = []; var titulos = new array( 'peaje', 'ruta', 'fecha cruce', 'hora', 'valor' ); body.push( titulos ); (key in peajes) { if (peajes.hasownproperty(key)) { var peaje = peajes[key]; var fila = new array(); fila.push( peaje.peaje.tostring() ); fila.push( peaje.ruta.tostring() ); fila.push( peaje.fechacruce.tostring() ); fila.push( peaje.hora.tostring() ); fila.push( peaje.valor.tostring() ); body.push(fila); } } console.log( body ); var docdefinition = { content: [ { table: { headerrows: 1, widths: [ '*', 'auto', 100, '*' ], body: body } }] };//end docdefinition pdfmake.createpdf(docdefinition).open(); }//end success });

this illustration of library http://pdfmake.org/#/gettingstarted

i don't know doing wrong?

you should create array of culumn name & value

class="snippet-code-js lang-js prettyprint-override">var column = []; column.push({ text: 'a', style: 'tableheader'}); column.push({ text: 'b', style: 'tableheader'}); var value = []; value.push({ text: 'asda', style: 'tableheader'}); value.push({ text: 'bsa', style: 'tableheader'});

when create table, should this.

class="snippet-code-js lang-js prettyprint-override">table: { headerrows: 1, body: [ column, value ] }

javascript pdf-generation pdfmake

web scraping - removing multiple \n in python before sentence tokenizing -



web scraping - removing multiple \n in python before sentence tokenizing -

i'm brand new programming , teaching myself out of book , stack overflow. i'm trying remove multiple instances of \n in a chat corpus , tokenize sentences. if don't remove \n, strings this:

['answers 10-19-20suser139 ... hi 10-19-20suser101 ;)\n\n\n\n\n\n\n\n\n\ni when it, 10-19-20suser83\n\n\n\n\n\n\n\n\n\n\n\niamahotnipwithpics\n\n\n\n10-19-20suser20 go plan wedding!']

i've tried several different methods chomps, line, rstrip, etc , none of them seem work. using them wrong. whole code looks this:

import nltk, re, pprint nltk.corpus import nps_chat chat= nltk.text(nps_chat.words()) nltk.corpus import npschatcorpusreader bs4 import beautifulsoup chat=nltk.corpus.nps_chat.raw() soup= beautifulsoup(chat) soup.get_text() text =soup.get_text() print(text[:40]) print(len(text)) nltk.tokenize import sent_tokenize sent_chat = sent_tokenize(text) len(sent_chat) text[:] = [line.rstrip('\n') line in text] print(len(sent_chat)) print(sent_chat[:40])

when utilize line method error:

traceback (most recent phone call last): file "c:\python34\lib\idlelib\testsubjects\sentencelen.py", line 57, in <module> text[:] = [line.rstrip('\n') line in text] typeerror: 'str' object not back upwards item assignment

help?

>>> x = 'answers 10-19-20suser139 ... hi 10-19-20suser101 ;)\n\n\n\n\n\n\n\n\n\ni when it, 10-19-20suser83\n\n\n\n\n\n\n\n\n\n\n\niamahotnipwithpics\n\n\n\n10-19-20suser20 go plan wedding!' >>> y = "".join([i if !="\n" else "\t" in x]) >>> z = [i in y.split('\t') if i] >>> z ['answers 10-19-20suser139 ... hi 10-19-20suser101 ;)', 'i when it, 10-19-20suser83', 'iamahotnipwithpics', '10-19-20suser20 go plan wedding!']

python web-scraping nlp nltk data-cleaning

c - Pointer losing its value + execv compilation warning -



c - Pointer losing its value + execv compilation warning -

i hope haven't missed similar question.

i'm trying code mini-shell of own, using primitive c functions.

i got should work, have pointer makes bug.

my adrcmd pointer should command-path string searchcmd() function , maintain same value in main function.

in fact: points right value on searchcmd(), not in main().

here's code:

int searchcmd(char* cmd, char* adrcmd){ char* path = getenv("path"); if(debug)printf("path : %s\n", path); int nbpath = (comptelettre(path, ':')+1); char** pathtab = malloc(nbpath*sizeof(char*)); decompose(path, pathtab, 2048, ':'); int i; char* adr = malloc(sizeof(char*)); for(i=0; i<nbpath; i++){ sprintf(adr, "%s/%s", pathtab[i], cmd); if(debug)printf(" source : %s \n", adr); int fs = open(adr, o_rdonly); // si on peut ouvrir le fichier, c'est qu'il existe ! if(fs != -1){ // si le fichier existe, on le renvoie; if(debug){ printf("commande trouvée dans path ! \n"); printf("%s \n", adr); } adrcmd = adr; printf("%s ?= %s \n",adrcmd, adr );// oui homecoming 1; } } homecoming 0; } /**********************\ main \**********************/ int main(int argc, char** argv){ printf("mini-shell : ok \n"); char cmd[cmdsize]; char** splited = malloc(cmdsize*sizeof(char*)); char* adrcmd = malloc(sizeof(char*)); char* params; while(printf("$ : ") && gets(cmd) && (strcmp(cmd, "exit")!=0 && strcmp(cmd, "quit")!=0)){ // on boucle tant que la commande != "exit" ou "quit" printf("votre commande : %s \n", cmd); decompose(cmd, splited, cmdsize, ' '); if(debug)affichecmd(splited, cmdsize); if(!searchcmd(splited[0], adrcmd)){ printf("commande n'existe pas, essayez apt-get install %s\n", splited[0]); }else{ if(debug)printf("execution de la commande '%s' : \n", adrcmd); params = splited[1]; // params = array(splited[1], splited[2], ...... ) if(execv(adrcmd, params) == -1){ printf("erreur d'exection de la commande\n"); } } } printf("fin du programme %s \n", argv[0]); homecoming 0; }

here's execution returns:

$ ./a.out mini-shell : ok $ : ls /var votre commande : ls /var cmd[0] = ls cmd[1] = /var path : /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games source : /usr/lib/lightdm/lightdm/ls source : /usr/local/sbin/ls source : /usr/local/bin/ls source : /usr/sbin/ls source : /usr/bin/ls source : /sbin/ls source : /bin/ls commande trouvée dans path ! /bin/ls /bin/ls ?= /bin/ls execution de la commande '' : erreur d'exection de la commande

and while i'm here, when compile, execv returns warning:

$ gcc shell.c shell.c: in function ‘main’: shell.c:113:4: attending : passing argument 2 of ‘execv’ incompatible pointer type [enabled default] /usr/include/unistd.h:564:12: note: expected ‘char * const*’ argument of type ‘char *’

what should avoid this?

c pass value. when doing this

int searchcmd(char * cmd, char * adrcmd){

adrcmd re-create of had been passed in. overwriting re-create won't alter had been copied in caller.

to prepare pass downwards address of adrcmd:

int searchcmd(char * cmd, char ** padrcmd){

and utilize this:

*padrcmd = adr;

call searchcmd() this:

if(!searchcmd(splited[0], &adrcmd)){

and define , initialise adrcmd this;

char * adrcmd = null;

c pointers execv

payflowpro - Paypal Payflow Pro API is returning null in AVSADDR and AVSZIP for card declined transactions -



payflowpro - Paypal Payflow Pro API is returning null in AVSADDR and AVSZIP for card declined transactions -

i using paypal pay-flow pro api credit card payments address verification service. problem if credit card transaction declined, paypal returns null avsaddr , avszip. need utilize these values if transaction declined.

how can these values?

the transaction id "a1x07c06757f" not decline . indicates card number entered wrong . since card number wrong , paypal not send info processor , hence there no response related avs , csc . if transaction declined(result=12)or successful see avs , csc response .

paypal payflowpro

php - Flexslider - Load specific slide from huge group -



php - Flexslider - Load specific slide from huge group -

i'm working on slider browse available units in condo building. touchscreen in building made sense utilize flexslider since it's touch friendly , easy set up. here's working example... hard part... there close 300 slides, , unit #s don't match slide #s. slide 5 might unit 412. have recommendation on how link specific slide separate page other keeping huge list of variables assigning each unit # slide in array?

thanks input!

php jquery ajax flexslider

javascript - [three.js toggle through models using GUI -



javascript - [three.js toggle through models using GUI -

i models in scene , using dat.gui able toggle through different models.

so far have tried doing changing visibility on/off using code:

var gui = new dat.gui(); var controls = { toggleobjects: function(){ g3white.traverse(function(child){child.visible = true;}); g3black.traverse(function(child){child.visible = false;}); } }; gui.add(controls, 'toggleobjects');

however, maintain getting errors break code: uncaught typeerror: undefined not function

additionally, have more 2 models , @ click of button model displays , other hidden.

is best/easiest way go or there else should do?

any help appreciated, i'm sort of three.js beginner.

you should traversing scene, checking if kid object want , turning on/off visibility.

javascript three.js

log4j - JBoss 7.1 hibernate sql query logging not in new line what should i do? -



log4j - JBoss 7.1 hibernate sql query logging not in new line what should i do? -

10:52:16,587 info [stdout] (http--0.0.0.0-8080-3) hibernate: 10:52:16,587 info [stdout] (http--0.0.0.0-8080-3) select 10:52:16,587 info [stdout] (http--0.0.0.0-8080-3) agebandage0_.age_band_age_id age_band4_5_0_, 10:52:16,587 info [stdout] (http--0.0.0.0-8080-3) agebandage0_.age_band_age_share_id age_band1_6_0_, 10:52:16,587 info [stdout] (http--0.0.0.0-8080-3) agebandage0_.age_band_age_share_id age_band1_6_1_, 10:52:16,587 info [stdout] (http--0.0.0.0-8080-3) agebandage0_.age_band_age_id age_band4_6_1_, 10:52:16,588 info [stdout] (http--0.0.0.0-8080-3) agebandage0_.is_active is_activ2_6_1_, 10:52:16,588 info [stdout] (http--0.0.0.0-8080-3) agebandage0_.share_amount share_am3_6_1_, 10:52:16,588 info [stdout] (http--0.0.0.0-8080-3) agebandage0_.tier_id tier_id5_6_1_ 10:52:16,588 info [stdout] (http--0.0.0.0-8080-3) 10:52:16,588 info [stdout] (http--0.0.0.0-8080-3) eba_age_band_age_share agebandage0_ 10:52:16,589 info [stdout] (http--0.0.0.0-8080-3) 10:52:16,589 info [stdout] (http--0.0.0.0-8080-3) agebandage0_.age_band_age_id=?

i want log sql query in next manner :

10:52:16,588 info [stdout] (http--0.0.0.0-8080-3) hibernate: select agebandage0_.age_band_age_id age_band4_5_0_, agebandage0_.age_band_age_share_id age_band1_6_0_, agebandage0_.age_band_age_share_id age_band1_6_1_, agebandage0_.age_band_age_id age_band4_6_1_, agebandage0_.is_active is_activ2_6_1_, agebandage0_.share_amount share_am3_6_1_, agebandage0_.tier_id tier_id5_6_1_ eba_age_band_age_share agebandage0_ agebandage0_.age_band_age_id=?

hibernate query logging writes stdout, system.out, wrapped logger in jboss 7. wrapped stream processes each line separately logging each line separately why see prefix on each line.

there no way turn off. create logger called stdout , assign handler doesn't formatting. give pattern of %s%n. print each line no formatting.

log4j jboss7.x

linux - ubuntu 12.04 system running so slow after installing xen and changing grub settings -



linux - ubuntu 12.04 system running so slow after installing xen and changing grub settings -

i have ubuntu 12.04 scheme installed xen using these instructions: https://help.ubuntu.com/community/xenproposed

i set memory limit 512m. now.. when reboot computer, slow, it's taken 10 minutes render default desktop (kate) after log in. i'm not savvy plenty linux know how undo properly. if wanted test undoing changes grub, reverse of command?

sudo sed -i 's/grub_default=.*\+/grub_default="xen 4.1-amd64"/' /etc/default/grub

if have other suggestions on how can resolve this, that'd great. thanks.

i had set next value in /etc/default/grub:

grub_default=0

linux ubuntu-12.04 xen

linux - What facility does system crontab provide that user crontab for root cannot? -



linux - What facility does system crontab provide that user crontab for root cannot? -

i expand question here:

what need of scheme crontab when every user including root has own crontab? existence of scheme crontab seems duplicate functionality. scheme crontab more of artifact of history of cron system?

system crontab great way distro maintainers , app packagers include cron jobs don't pollute user crontab space.

the scheme crontab files can specify user run as, not in scheme crontab has run root.

non-login-users don't have crontabs, place set non-login-user tasks in scheme crontab.

generally, set local/custom stuff in root (or appropriate user) crontab, while prepackaged stuff don't straight maintain lives in scheme crontab.

really, it's matter of organization

linux cron

java - Why Does AffineTransform Scale When Rotating -



java - Why Does AffineTransform Scale When Rotating -

it's more math problem, why method fail?

public void test() { affinetransform transform = affinetransform.getrotateinstance(1); system.out.println("scalex = " + transform.getscalex() + ", " + "scaley = " + transform.getscaley()); assert.assertequals(1, transform.getscalex(), 0.001); // fails assert.assertequals(1, transform.getscaley(), 0.001); // fails, }

the output is: scalex = 0.5403023058681398, scaley = 0.5403023058681398

just looking @ i'd scaling should not alter while rotating.

the scalex , scaley values getting cos(1 rad) correct.

they not represent scale of object after applying affine transformation. per this documentation, scalex contribution of initial x coordinate before transform final x coordinate after transform. same goes scaley. doesn't mean x1 = x0*scalex, x1 = x0*scalex + y0*m01y + m02.

to assert there no scaling done, can matrix values of transformation , determinant. if there no scale or shear, determinant 1. furthermore 2 components representing displacement should 0.

double[] m = transform.getmatrix() assert.assertequals(1, m[0]*m[4] - m[1]*m[3], 0.001) assert.assertequals(0, m[2], 0.001); assert.assertequals(0, m[5], 0.001);

java awt affinetransform

javascript - Libsyn RSS with Google Feed -



javascript - Libsyn RSS with Google Feed -

i'm using google feeds api read rss-feeds libsyn.

as i've noticed google parses feed , hence excludes lot of stuff. there way alter include image link included in rss-feed?

var feed = new google.feeds.feed('http://podiet.libsyn.com/rss'); feed.setnumentries(25); feed.load(function (data) { console.log(data); });

it's working fine except fact of things in feed excluded.

set:

feed.setresultformat(google.feeds.feed.mixed_format)

then image tags included. can extracted example:

var feed = new google.feeds.feed('http://podiet.libsyn.com/rss'); feed.setresultformat(google.feeds.feed.mixed_format); feed.setnumentries(25); feed.load(function(result) { (var = 0; < result.feed.entries.length; i++) { var entry = result.feed.entries[i]; var itunesimageurl = entry.xmlnode.getelementsbytagnamens( 'http://www.itunes.com/dtds/podcast-1.0.dtd', 'image')[0]. attributes.getnameditem('href').value; console.log(itunesimageurl); } });

javascript rss feed google-feed-api

iis 7 - Will Installing PHP on IIS 7 Interrupt Active Server Pages -



iis 7 - Will Installing PHP on IIS 7 Interrupt Active Server Pages -

i getting ready migrate classic asp build php on same server. i'm getting ready install php on server , i'm getting cold feet. should expect interruption ability host asp files? there problems occur installing php on iis 7? important downwards time not option. input has gone through process.

php iis-7

Add total cost field in sales order report magento -



Add total cost field in sales order report magento -

i have tried total cost in sales order study without success. can see related info in "sales_order_aggregated_created" , "sales_order_aggregated_updated" tables in database unable see total cost of orders. info beingness managed through app/code/core/mage/sales/model/resource/order/collection.php

please help if 1 have thought same value.

finally have done same. have made corrections in 3 files total cost field in sales order report. first of re-create 3 core files local folder. 1.add total cost app/code/local/mage/sales/model/resource/report/order/createdat.php in columns array around line number 95 'total_base_cost' => new zend_db_expr('sum(oi.total_base_cost)') dont forget add together same column (total_base_cost) in sales_order_aggregated_created table in databse. $columns below: $columns = array( // convert dates utc current admin timezone 'period' => $periodexpr, 'store_id' => 'o.store_id', 'order_status' => 'o.status', 'orders_count' => new zend_db_expr('count(o.entity_id)'), 'total_qty_ordered' => new zend_db_expr('sum(oi.total_qty_ordered)'), 'total_base_cost' => new zend_db_expr('sum(oi.total_base_cost)'), 'total_qty_invoiced' => new zend_db_expr('sum(oi.total_qty_invoiced)'), 'total_income_amount' => new zend_db_expr( sprintf('sum((%s - %s) * %s)', $adapter->getifnullsql('o.base_grand_total', 0), $adapter->getifnullsql('o.base_total_canceled',0), $adapter->getifnullsql('o.base_to_global_rate',0) ) ), , add together same column in $cols array value sales/order_item table around line number 204 'total_base_cost' => new zend_db_expr('sum(base_cost)') $cols array is: $cols = array( 'order_id' => 'order_id', 'total_qty_ordered' => new zend_db_expr("sum(qty_ordered - {$qtycanceledexpr})"), 'total_base_cost' => new zend_db_expr('sum(base_cost)'), 'total_qty_invoiced' => new zend_db_expr('sum(qty_invoiced)'), ); 2. add together same column in app/code/local/mage/sales/model/resource/report/order/collection.php arround line 87 'total_base_cost' => 'sum(total_base_cost)', $this->_selected array below: $this->_selectedcolumns = array( 'period' => $this->_periodformat, 'orders_count' => 'sum(orders_count)', 'total_qty_ordered' => 'sum(total_qty_ordered)', 'total_base_cost' => 'sum(total_base_cost)', 'total_qty_invoiced' => 'sum(total_qty_invoiced)', 'total_income_amount' => 'sum(total_income_amount)', 'total_revenue_amount' => 'sum(total_revenue_amount)', 'total_profit_amount' => 'sum(total_profit_amount)', 'total_invoiced_amount' => 'sum(total_invoiced_amount)', 'total_canceled_amount' => 'sum(total_canceled_amount)', 'total_paid_amount' => 'sum(total_paid_amount)', 'total_refunded_amount' => 'sum(total_refunded_amount)', 'total_tax_amount' => 'sum(total_tax_amount)', 'total_tax_amount_actual' => 'sum(total_tax_amount_actual)', 'total_shipping_amount' => 'sum(total_shipping_amount)', 'total_shipping_amount_actual' => 'sum(total_shipping_amount_actual)', 'total_discount_amount' => 'sum(total_discount_amount)', 'total_discount_amount_actual' => 'sum(total_discount_amount_actual)', ); 3. final display column in sales order study grid adding same column in file app/code/local/mage/adminhtml/block/report/sales/sales/grid.php $this->addcolumn('total_base_cost', array( 'header' => mage::helper('sales')->__('cost'), 'type' => 'currency', 'currency_code' => $currencycode, 'index' => 'total_base_cost', 'total' => 'sum', 'sortable' => false, 'rate' => $rate, )); may help else wants add together same column.

magento

Mysql Subquery too slow, query sale number -



Mysql Subquery too slow, query sale number -

i have 3 table: one: table order_info

ordre_id int add_time int

two: table order_goods

id int goods_id int order_id int sale_number int

three: table goods

goods_id int goods_name varchar

now want query goods sale total number , order number, , when goods has no sale number, show zero. utilize subquery, it's slowly, sql like:

select t.* goods tg left bring together ( select sum(og.goods_number) total_num, g.goods_id, g.goods_name order_info oi left bring together order_goods og on oi.order_id=og.order_id left bring together goods g on g.goods_id=og.goods_id oi.add_time>1415635200 ) t on t.goods_id=tg.goods_id order t.total_num desc;

can have goods idea? thanks!

why not remove outer query part , run

select sum(og.goods_number) total_num, g.goods_id, g.goods_name order_info oi left bring together order_goods og on oi.order_id=og.order_id left bring together goods g on g.goods_id=og.goods_id right bring together goods g2 on g2.goods_id=og.goods_id oi.add_time > 1415635200

? indices have set on tables?

mysql subquery

erlang - Module properties Elixir -



erlang - Module properties Elixir -

i new in elixir/erlang programming.

how can implement module attributes elixir module, user of module can set in module constructor.

for example,

defmodule config some_property: nil other_property: nil def constructor(one, two) some_property = 1 other_property = 2 end def get_property_one some_property end end

thank you

elixir modules not classes , variables defined within them not properties, there no such things constructors , destructors. elixir based on erlang, firstly, recommend reading erlang , object oriented programming:

why oo sucks joe armstrong object oriented programming: wrong path? why programme in erlang

this should give basic idea, why objects getters , setters aren't supported. closest thing having object state have server state. in server loop, can this:

def loop(state) newstate = receive { :get_property_one, pid } -> pick_the_property_from_state_and_send_to_pid(state, pid) state { :set_property_one } -> set_property_one_and_return_new_state(state) end loop(newstate) end

spawning new server initial state close createing new object using constructor. sending :get_property_one getter, asynchronous (you can else before waiting reply). sending :set_property_one doesn't wait reply, non blocking.

this might cumbersome, solves couple of problems:

you not have readers, writers problem in erlang, because requests processed 1 one if getters , setters require complex operations, can done asynchronously (without blocking calling process)

this pattern common, there behaviour called gen_server, eliminates of boilerplate of looping. if still think, there much boilerplate write, can read my article it (this 1 in erlang)

erlang elixir

ajax - jQuery data binding library or plugin recommendation -



ajax - jQuery data binding library or plugin recommendation -

stopping short of total blown frameworks such angular, knockout etc, recommend jquery plugin simple info binding?

it's needed shopping cart 1 page app needs update elements on page after ajax completion. needs iterate through fields , update user interface.

yes, know write myself, don't want reinvent wheel if there out there.

my research has lead me jquery.bindings - it's not popular ( 1 contributor )

suggestions?

look rivets.js.

rivets lightweight (3.4kb minified , gzipped) , powerful info binding , templating library.

rivets.js agnostic model / controller layer , works existing libraries employ event-driven model such backbone.js , stapes.js. ships built-in adapter subscribing plain js objects using es5 natives, can replaced watch.js adapter or object.observe adapter.

some of features out-of-the-box rivets.js:

bi-directional info binding , dom nodes. computed properties through dependency mapping. formatters allow mutating values through piping. iteration binding binding items in array. custom event handlers fit ideal workflow. uniform apis extending of core concepts.

rivets uses dom-based templating system:

instead of parsing , compiling template strings html, rivets.js wires models straight existing parts of dom contain binding declarations , command flow instructions straight on dom nodes. pass in models when binding parent dom node , rivets.js takes care of rest.

in short, illustration assume want display info in product object like:

var productinfo= { name: "test", price: 1000 }

in next html:

<ul id="product"> <li>name</li> <li>price</li> </ul>

your can bind info using rivets like:

rivets.bind($('#product'), { product: productinfo // product alias name within html template });

and corresponding rivets template be:

<ul id="product"> <li rv-text="product.name"></li> <li v-text="product.price"></li> </ul>

or more semantically:

<ul id="product"> <li data-rv-text="product.name"></li> <li data-rv-text="product.price"></li> </ul>

the rivets.bind method accepts template element, model data, options wish override main rivets object (optional)

or if binding array of product objects:

rivets.bind($('#product'), { product: productarray // productarray array of products });

you can utilize iteration bindings using rv-each like:

<ul class="products" data-rv-each-product="products"> <li data-rv-text="product.name"></li> <li data-rv-text="product.price"></li> </ul>

rivets create n number of lists according items in array.

there many more cool features can find in guide.

jquery ajax plugins data-binding jquery-plugins

Conditional Error Handling in Javascript -



Conditional Error Handling in Javascript -

when deciding if ignore, handle of re-throw errors in try catch structure, best way uniquely identify exact error?

i can't find standard error number, have parse name , message properties?

edit: in illustration below, want check if error due lack of property on listevent who's key value of evnt.type. if source of error, want ignore it, otherwise want re-throw allow bubble up.

the way can think of sort of duck-typing error this...

try{ listevent[evnt.type](procedure) }catch(error){ if (error.message.match(evnt.type)) { console.log(error.name + ' ' + error.message + ' - ignored') } else { throw error } }

create custom exception , utilize instanceof:

function illegalargumentexception(message) { this.message = message; }

you want create extend error prototype:

illegalargumentexception.prototype = new error(); illegalargumentexception.prototype.constructor = error;

which can utilize so:

throw new illegalargumentexception("argument cannot less zero");

you can check type using instanceof:

try { // code generates exceptions } grab (e) { if (e instanceof illegalargumentexception) { // handle } else if (e instanceof someothertypeofexception) { // handle } }

you can add together other property want constructor of exception.

as far illustration goes, i'm not sure you're trying do. listevent[evnt.type] homecoming undefined if event.type not property or key in listevent. improve see if evnt.type exists doing this:

if (typeof listevent[evnt.type] !== "undefined") { listevent[evnt.type](procedure); }

javascript error-handling

c++ - Outputing Unicode to stdout -



c++ - Outputing Unicode to stdout -

i utilize solution here output unicode strings in windows console app

in particular, seek next gives exception

#include <iostream> #include <io.h> #include <fcntl.h> _setmode(_fileno(stdout), _o_u16text); wcout << l'\u00de' << endl;

details of exception:

--------------------------- microsoft visual c++ debug library --------------------------- debug assertion failed! program: d:\code.exe file: f:\dd\vctools\crt_bld\self_x86\crt\src\fputc.c line: 48 expression: ( (_stream->_flag & _iostrg) || ( fn = _fileno(_stream), ( (_textmode_safe(fn) == __ioinfo_tm_ansi) && !_tm_unicode_safe(fn)))) info on how programme can cause assertion failure, see visual c++ documentation on asserts. (press retry debug application) --------------------------- abort retry ignore ---------------------------

c++ visual-c++ visual-c++-2010

c# - Listening for events only under certain circumstance -



c# - Listening for events only under certain circumstance -

i'm after opinions / advice i'm rather new event-driven programming , c# having come web development origins.

i'm making programme in c# / winforms, series of splitcontainer controls on main form. want allow user able select grouping of them, 3 out of 8 (not limited that). start selecting them, user click button , programme go selecting mode, , @ time, if user clicks on control, color of alter indicating selected.

at stage, have made work fine, sense it's not efficient in detection of mousemove events. i've bound mousemove event splitcontainer, , within event, programme detects whether we're in selecting mode. if so, , user clicks, alter color. if not in selecting mode, wont anything.

my worry every time user moves cursor on control, event fired , detects whether selecting mode enabled. sense should other way around, is; in selecting mode such event listened to.

here cut-outs explain i've got @ moment.

public bool selectingmode = false; public form(){ splitcontainer split = new splitcontainer(); split.mousemove += new mouseeventhandler(mousemoved); this.controls.add(split); } void mousemoved(object sender, mouseeventargs e){ if(selectingmode){ //change color of split } }

as mentioned, mousemoved() method triggered every time user moves cursor on control, , actions if it's in selectingmode. there way reverse this? trigger event if in selectingmode?

if i'm worrying doesn't matter, able explain why? seems poor practice , using scheme resources (however little), considering vast bulk of time using programme spent cursor within box.

i appreciate , input, thanks! sean

implement selectingmode property , set in setter split.mousemove += new mouseeventhandler(mousemoved); or split.mousemove -= new mouseeventhandler(mousemoved); depending on true or false.

besides don't think alter necessary performance reasons.

c# winforms visual-studio

Grunt Karma unit task fail with AngularJS project -



Grunt Karma unit task fail with AngularJS project -

i have problem executing grunt karma:unit, task finished throw this:

....... debug [web-server]: serving (cached): c:/project/yo /test/spec/services/lists.js firefox 32.0.0 (windows 7): executed 0 of 0 error (0.027 secs / 0 secs) debug [karma]: run complete, exiting. debug [launcher]: disconnecting browsers debug [launcher]: process firefox exited code 0 debug [temp-dir]: cleaning temp dir c:\users\developer\appdata\local\temp\karma-14 854612 warning: task "karma:unit" failed. utilize --force continue. aborted due warnings. execution time (2014-10-16 21:25:51 utc) karma:unit 4.1s ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 100% total 4.1s

the test directory contains test empty, example:

'use strict'; describe('service: lists', function () { });

i don't understand why result is: warning: task "karma:unit" failed. utilize --force continue..

my karma.conf.js file contains:

module.exports = function(config) { 'use strict'; config.set({ autowatch: true, basepath: '../', // testing framework utilize (jasmine/mocha/qunit/...) frameworks: ['jasmine'], // list of files / patterns load in browser files: [ 'app/bower_components/jquery/dist/jquery.js', 'app/bower_components/angular/angular.js', 'app/bower_components/json3/lib/json3.js', 'app/bower_components/bootstrap/dist/js/bootstrap.js', 'app/bower_components/jquery-ui/jquery-ui.js', 'app/bower_components/angular-animate/angular-animate.js', 'app/bower_components/angular-route/angular-route.js', 'app/bower_components/angular-sanitize/angular-sanitize.js', 'app/bower_components/angular-touch/angular-touch.js', 'app/bower_components/lodash/dist/lodash.compat.js', 'app/bower_components/restangular/dist/restangular.js', 'app/bower_components/angular-ui-router/release/angular-ui-router.js', 'app/bower_components/angular-bootstrap/ui-bootstrap-tpls.js', 'app/bower_components/angular-translate/angular-translate.js', 'app/bower_components/angular-moment/angular-moment.js', 'app/bower_components/angular-ui-router/release/angular-ui-router.js', 'app/bower_components/angular-translate-loader-static-files/angular-translate-loader-static-files.js', 'app/scripts/**/*.js', 'test/spec/**/*.js' ], exclude: [], port: 8080, browsers: [ 'firefox' ], plugins: [ 'karma-firefox-launcher', 'karma-jasmine' ], singlerun: false, colors: true, loglevel: config.log_debug, }); };

karma needs at to the lowest degree 1 test create work/succeed. take in debug output:

firefox 32.0.0 (windows 7): executed 0 of 0 error (0.027 secs / 0 secs)

once add 1 test, work:

firefox 32.0.0 (windows 7): executed 1 of 1 error (0.031 secs / 0 secs)

how create console log , error's displayed in console output while running test?

please add together progress param karma configuration file.

you can read in documentation here: http://karma-runner.github.io/0.8/config/configuration-file.html

reporters: ['progress'],

angularjs unit-testing e2e-testing

java - Ebean PersistenceException- don't see datasource -



java - Ebean PersistenceException- don't see datasource -

i'am new in play framework world. recently, seek launch simple application utilize ebean orm.

database part of application.conf file like:

datasource.default.username= user datasource.default.password= "" datasource.default.databaseurl="jdbc:mysql://localhost:3306/test" datasource.default.databasedriver=com.mysql.jdbc.driver ebean.default="models.*"

when seek operation using ebean- illustration

ebean.begintransaction();

it cause:

play.api.application$$anon$1: execution exception[[persistenceexception: default ebeanserver has not been defined? set via ebean.datasource.default property. otherwise should registered programatically via registerserver()]] @ play.api.application$class.handleerror(application.scala:293) ~[play_2.10-2.2.1.jar:2.2.1] @ play.api.defaultapplication.handleerror(application.scala:399) [play_2.10-2.2.1.jar:2.2.1] @ play.core.server.netty.playdefaultupstreamhandler$$anonfun$2$$anonfun$applyorelse$3.apply(playdefaultupstreamhandler.scala:261) [play_2.10-2.2.1.jar:2.2.1] @ play.core.server.netty.playdefaultupstreamhandler$$anonfun$2$$anonfun$applyorelse$3.apply(playdefaultupstreamhandler.scala:261) [play_2.10-2.2.1.jar:2.2.1] @ scala.option.map(option.scala:145) [scala-library.jar:na] @ play.core.server.netty.playdefaultupstreamhandler$$anonfun$2.applyorelse(playdefaultupstreamhandler.scala:261) [play_2.10-2.2.1.jar:2.2.1] caused by: javax.persistence.persistenceexception: default ebeanserver has not been defined? set via ebean.datasource.default property. otherwise should registered programatically via registerserver() @ com.avaje.ebean.ebean$servermanager.getprimaryserver(ebean.java:197) ~[ebean-2.8.1.jar:na] @ com.avaje.ebean.ebean$servermanager.access$300(ebean.java:147) ~[ebean-2.8.1.jar:na] @ com.avaje.ebean.ebean.begintransaction(ebean.java:374) ~[ebean-2.8.1.jar:na] @ controllers.application2.dosthinjava(application2.java:32) ~[na:na] @ routes$$anonfun$routes$1$$anonfun$applyorelse$2$$anonfun$apply$2.apply(routes_routing.scala:57) ~[na:na] @ routes$$anonfun$routes$1$$anonfun$applyorelse$2$$anonfun$apply$2.apply(routes_routing.scala:57) ~[na:na]

what wrong?

in play 2.x right syntax is:

db.default.user="your user" db.default.password="your pass" db.default.url="jdbc:mysql://localhost:3306/test" db.default.driver="com.mysql.jdbc.driver" ebean.default="models.*"

java scala orm playframework ebean

Android App XML multiple screen support -



Android App XML multiple screen support -

i made calculator app , used density independent pixels create layout, place buttons , on. yet on tablet emulator doesnt display correctly, takes 1/4 of screen. on phone(800x480) ok. how can adress issue?

you'll need provide additional layout folders different screen sizes android scheme doesn't utilize same 1 default, resulting in behavior you've described.

this accomplished adding layout folders size specifiers such as: small, medium, big , xlarge.

layout-small example.

so, clear, you're adding additional folders different supported screen sizes. you'll add together layout of same name each folder add. scheme handles headache.

you alter layout accomplish best results. note mutual practice, when dealing larger screen sizes, provide more content on single screen opposed blowing up. if app can benefit that, looks improve having obscenely big buttons stringing across screen, imho.

for finish run down, please refer android documentation.

android xml screen resolution

soap - Losing WCF FaultException details when using binary -



soap - Losing WCF FaultException details when using binary -

i have wcf service next custom binding:

<binding name="binaryhttpbinding" > <binarymessageencoding /> <httptransport maxreceivedmessagesize="2147483647" /> </binding>

(the client has of course of study configuration matches binding). problem client doesn't receive generic faultexception, e.g. "t" not received client, can verify if trace calls. if replace binarymessageencoding textmessageencoding using soap 1.2, fault exceptions come enriched fault detail.

i searched on net , wasn't able find info claim binary message encoding on http not compatible generic wcf fault exceptions. doesn't can command much of binary message encoding - illustration can't set in configuration soap message version (not supported wcf binary encoding). wonder whether scenario supported.

after spending quite hours on trying figure out go wrong, i've made work. 2 reasons failure, none of them obvious.

the fault message class has overridden tostring method did computation. sure unwise set such logic in tostring, guess impact binary serialization? faultexception constructor has optional parameter "actionname" set name of method exception occurred. apparently wcf quite picky can assigned action name leaving blank works. again, guess impact binary serialization , in such unusual way (so discards message fault on client side)?

wcf soap encoding wcf-binding faultexception

Ruby script hangs forever -



Ruby script hangs forever -

this little script supposed generate user-specified amount of random numbers , print them. it's multithreaded script , think that's problem lies. i'm not getting errors, when run script hangs.

num = [] while 0.upto argv[0].to_i num << rand{254} end current_index = 0 while current_index < num.size chunk = num[current_index, 5] threads = [] chunk.each |n| threads << thread.new puts n end end threads.each |thread| thread.join end current_index += chunk.size end

you cannot utilize while loop upto.

change to:

0.upto argv[0].to_i num << rand(254) end

and works (i've changed braces curly one, because believe want 254 parameter here).

sidenote:

remember when writing threads programme in ruby, cruby has gil - global interpreter lock. hence 1 thread operating @ 1 time. if want different behaviour - switch illustration jruby. more info gil can found f.e. here: http://www.jstorimer.com/blogs/workingwithcode/8085491-nobody-understands-the-gil

ruby

asp.net mvc 4 - mvc4 How to extract value from a tolist query in controller -



asp.net mvc 4 - mvc4 How to extract value from a tolist query in controller -

ok basic setup; user logins unique id of user myid, seek list of logged in user friends going friends table shown in variable myfriends notice have selected friendid column represents uniqueid of friend. compare myid profileid should match if they're friends. problem using .tolist() on myfriends variable , can't seem extract friendid (i using tolist() because user can have more 1 friend tolist counts amount of records) compare in friendprofile variable because .tolist() gives value of how many records extracted. how can friendid value myfriends can compare in friendprofile can show users friends profile ? help great

[authorize] public actionresult myprofile() { // logged in user unique id int myid = convert.toint32(user.identity.name); // list of logged in user friends id var myfriends = sqlconnection.query<friend>("select friendid friends myid=@profileid",new { profileid = myid }).tolist(); // friends profiles var friendprofile = sqlconnection.query<profile>("select * profiles friendid=@profile",new { profile = myfriends }).tolist(); }

you can single query using sql in operator

int myid = convert.toint32(user.identity.name); var friendprofile = sqlconnection.query<profile>("select * profiles friendid in (select friendid friends myid=@profile)",new { profile = myid }).tolist();

asp.net-mvc-4 model-view-controller actionresult

linux - Nano - disable confirm on save? -



linux - Nano - disable confirm on save? -

i utilize nano every day , hate when asks every time "save modified buffer? (yes/no)". how can disable this?

you can specify -t flag when starting nano. man page:

-t (--tempfile) save changed buffer without prompting. same pico's -t option.

linux nano

C - Segmentation fault with strtok() -



C - Segmentation fault with strtok() -

i trying date console , getting month, day , year work them separately.

const size_t max = 11; void getdate(date * d){ char line[max]; printf("\t insert date in american format (mm/dd/yyyy): "); fgets(line, max, stdin); d->month = atoi(strtok(line, "/")); d->day = atoi(strtok(null, "/")); d->year = atoi(strtok(null, " ")); }

i don't error executing once. segmentation fault error when seek 2 dates @ once.

date d1, d2; getdate(&d1); getdate(&d2);

and line gives me error d->day = atoi(strtok(null, "/")); during sec execution.

the problem utilize of fgets(). not returning think sec time around.

the first time through, fgets() fills line[] "10/23/2014\0" , well.

however, sec time through, enter key still in stdin's input buffer because first fgets() did not have room in line[] read it, sec fgets() fills line[] "\n\0" without waiting new user input. first phone call strtok(line, "/") returns "\n" (which atoi() converts 0), next phone call strtok(null, "/") fails , returns null, causes atoi() segfault.

increase size of array enter read each phone call fgets(). suggest utilize sscanf() instead of atoi(strtok()):

const size_t max = 16; void getdate(date * d) { char line[max]; printf("\t insert date in american format (mm/dd/yyyy): "); fgets(line, max, stdin); if (sscanf(line, "%d/%d/%d", &(d->month), &(d->day), &(d->year)) != 3) d->month = d->day = d->year = 0; }

alternatively, add together validation create sure date read properly:

const size_t max = 16; void getdate(date * d) { char line[max]; int consumed; printf("\t insert date in american format (mm/dd/yyyy): "); fgets(line, max, stdin); while (1) { if (sscanf(line, "%d/%d/%d%n", &(d->month), &(d->day), &(d->year), &consumed) == 3) { if (consumed == strlen(line)) break; } printf("\t invalid input. insert date in american format (mm/dd/yyyy): "); fgets(line, max, stdin); } }

c strtok

ios - Customizing the NavigationBar using Swift -



ios - Customizing the NavigationBar using Swift -

when seek adding custom attributes navigationbar, error: "could not find overload '/' accepts supplied arguments"...this started occurring recent xcode update. help appreciated. thanks!

navigationcontroller?.navigationbar.titletextattributes = [nsfontattributename: uifont(name: "avenirnext-bold", size: 30), nsforegroundcolorattributename: uicolor(red: (102/255.0), green: (45/255.0), blue: (145/255.0), alpha: 1.0)]

the problem uifont(name: "avenirnext-bold", size: 30) returns optional now. (as correctly state, started, in xcode 6.1.) need disclose (put exclamation mark after it) in order utilize in attributes dictionary.

ios swift uinavigationbar

c++ - memset() function outputs undesirably -



c++ - memset() function outputs undesirably -

here screenshot of problem.

the code is

#include <bits/stdc++.h> using namespace std; int a[6][500], b[6][500]; int main() { memset (a, 3, sizeof a); memset (b, -1, sizeof b); cout << a[2][50] << ' ' << b[2][50] << endl; homecoming 0; }

i don't understand why a[2][500] showing 50529027. can tell me what's difference between 2 memset() phone call ?

memset() in byte. a int, a[2][500] on 32 bit machine, value 0x03030303 = 50529027

c++

R shiny - How to transform String into piece of code to use it as input on Server.R? -



R shiny - How to transform String into piece of code to use it as input on Server.R? -

i trying values inputs ids "imp1", "imp2", "imp3",... there's no limit amount of 'imps' cannot done manually. thought create list called "impidlist" gets amount of 'imps' , assign string each entry of list "imp1", "imp2",... problem server.r doesn't utilize string's process inputs uses imp1, or imp2 or imp3... without quotes. happens when to:

impidlist<-for(i in 1:numimp){ impid<-paste("imp",tostring(i)) imps[[i]]<-input$impid }

because impid (3rd line) "imp1", not imp1.

ui.r (...) output$imps<-renderdatatable({ numimp<-(input$num_imp) imps<-list() impidlist<-for(i in 1:numimp){ impid<-paste("imp",tostring(i)) imps[[i]]<-input$impid } }) (...)

if more info needed (or question not in right format...) please vote downwards , @ to the lowest degree something...i kind of need help...

ok, solved it.

server.r uses inputs " input$something " , creates outputs " output$something ".

ui.r displays outputs xoutput("something"), , inputs created in widget as, example:

numericinput({ inputid="imp1", label="blah blah" )}

as had inputs id's "imp1", "imp2", "imp3",... , needed server.r utilize them input$imp1, input$imp2, input$imp3,... (without quotes) used parse within loop. saved inputs in list called "imps", input called "num_imps" got number of numericinputs. code looks like

v_imps<-reactive({ numimp<-(input$num_imp) imps<-list(c("a","b")) for(i in 1:numimp){ impid<-paste("imp",tostring(i),sep = "") imps[[1]][i]<-eval(parse(text = paste("input$",impid,sep = ""))) } imps })

i going set images of i've done have not plenty rep. anyway

r string list shiny quotes