Posts

Showing posts from January, 2015

ios - Export audio file after adding an effect -

i have audio file want process using effects (like pitch effect) , write final result file. before process file , save disc let user play pitch effect , listen changes in real time. this how real time stuff: let audiosession = avaudiosession.sharedinstance() audiosession.setcategory(avaudiosessioncategoryplayback, error: nil) audiosession.setactive(true, error: nil) audioengine = avaudioengine() audiofile = avaudiofile(forreading: audiourl!, error: nil) audioplayernode = avaudioplayernode() audioengine.attachnode(audioplayernode) changepitcheffect = avaudiounittimepitch() changepitcheffect.pitch = 1.0 // default audioengine.attachnode(changepitcheffect) audioengine.connect(audioplayernode, to: changepitcheffect, format: nil) audioengine.connect(changepitcheffect, to: audioengine.outputnode, format: nil) let framecapacity = uint32(audiofile.length) let buffer = avaudiopcmbuffer(pcmformat: audiofile.processingformat,

Drawing pixels inside a grid in VB.NET -

i have paint program shows zoomed in version of image editing , have interpolation mode set "nearest neighbor". also, have pixel grid drawn on there , grid on each place there pixel on image. shows accurate amount of pixels. added brush draw on picturebox want brush draw on squares in other drawing programs pixel grid views. long mouse pointer within pixel square, fill inside of pixel square in. here codes: (my picturebox named canvaseditor.) the code generates pixel grid: private sub canvaseditor_paint(byval sender object, byval e system.windows.forms.painteventargs) handles canvaseditor.paint if not bmpnew nothing e.graphics.drawimage(bmpnew, 0, 0) end if dim g graphics = e.graphics dim pn new pen(color.dimgray) '~~~ color of lines dim x integer dim y integer dim intspacing integer = 8 '~~~ spacing between adjacent lines '~~~ draw horizontal lines x = canvaseditor.wi

mysql - Error installing "nokogiri" in a Ruby on Rails application? -

i've been following along lynda.com's ruby on rails course. did mentioned inside videos. i trying run rails server command, should default webrick, correct? i run command , has issue in nokogiri.rb file , on line 29 error happening read: require 'nokogiri/nokogiri' which command prompt throwing on when running rails server command. idea causing this? if so, commands need run settle this? me sounds missed when installing mysql. i not sure nokogiri , why rails server won't run , points line of code. the path file (wherever installed folder to)\lib\ruby\gems\2.2.0\gems\nokogiri-1.6.6.2-x64-mingw32\lib edit**: have chain of errors, goes -long path-, -longpath- etcetera. tried installing latest gem, , wasn't successful. there log file can share guys figure out issue. nokogiri ruby "gem" (library) parsing xml , html. your rails project should have gemfile specifies name , version of each gem needed run project. install

asp.net mvc - convert model property value with javascript in razor -

i have foreach iterate through items in razor syntax, @foreach (var item in model) { <tr> <td> @html.displayfor(modelitem => item.name) </td> <td> @html.displayfor(modelitem => item.colorcode) </td> <td> <div style="background-color:*************">&nbsp;&nbsp;&nbsp;</div> </td> <td> @html.actionlink("edit", "edit", new { id = item.id }) | @html.actionlink("details", "details", new { id = item.id }) | @html.actionlink("delete", "delete", new { id = item.id }) </td> </tr> } colorcode int value ,i define external function named inttocolorhex convert colorcode equivalent hex value,i want replace ************** hex color value each row according colorcode,i need thing bellow: &l

ios - How to make two sides edges with keeping scale mode Aspect fill? -

i trying make edges 2 sides in scene using code let leftedge : sknode = sknode() leftedge.physicsbody = skphysicsbody(edgefrompoint: cgpointzero , topoint:cgpointmake(0.0, self.frame.size.height + 100)) leftedge.position = cgpointzero; leftedge.physicsbody!.categorybitmask = edgecategory; leftedge.physicsbody!.collisionbitmask = bubblescategory; self.addchild(leftedge) // right edge let rightedge : sknode = sknode() rightedge.physicsbody = skphysicsbody(edgefrompoint: cgpointzero , topoint:cgpointmake(0.0, self.frame.size.height + 100)) rightedge.position = cgpointmake(self.frame.size.width, 0.0); rightedge.physicsbody!.categorybitmask = edgecategory; rightedge.physicsbody!.collisionbitmask = bubblescategory; self.addchild(rightedge) it works fine if use resizefill scale mode want make mode aspectfill how can make edges keeping mode aspectfill ?

ios - How to have a swipe gesture back animation -

i have swipe gesture set "right" (swipe left right) , segue go previous view controller. if run app, gesture works (go back) animation appears right left (like i'm going next page instead of previous one) how can change animation go left right? can done via storyboard? thank you

HTML If I add some character to the text so it moves the next text -

i have problem texts in html code: <table width="100%"> <tr> <td align="left"><p style="font-family:arial;font-size:13px;color:white;">10000</p></td> <td align="center"><p style="font-family:arial;font-size:13px;color:white;">100 </p></td> <td align="right"><p style="font-family:arial;font-size:13px;color:white;">100 </p></td> </tr> </table> i want it, when add character first td (align left) move second , third td (align center , align right) thank every answer have nice day :) set width don't resize fit whatever content in cells, e.g. <table> <tr> <th>month</th> <th>savings</th> </tr> <tr> <td width="70%">january</td> <td width="30%">$100</td> <

javascript - Calendar view doesn't work in html5 sometimes -

i creating application in django , have next problem. have search forms in application, , in of them there fields of type 'datefield'. in addition, have implemented jquery function display calendar view when user clicks on date fields. code next: <script> $(function() { $( ".vdatefield" ).datepicker({ dateformat: 'yy-mm-dd' }).val(); }); </script> the problem doesn't work always. in pages, calendar view displayed correctly, in few others not. have put correctly class 'vdatefield' datefield attributes in forms in django this: self.fields['date'].widget.attrs = {'class': 'vdatefield'} so, why doesn't work? thank much! try wrap code in $(document).ready e.g. <script> $(document).ready(function(){ $(function() { $( ".vdatefield" ).datepicker({ dateformat: 'yy-mm-dd' }).val(); }); }); </script>

ios - Different behaviours for different colors in drawRect: -

this question has answer here: cgcolorgetcomponents() not returning correct values black , white 1 answer i puzzled way following code works. expected produce black disk surrounded colored circle. works fine colors (as explained in comments), not others. can explain misterious behaviour? - (void)drawrect:(cgrect)rect { cgrect rectangle; cgfloat shiftval=2.0,linewidth=3.0; rectangle.origin=cgpointmake(shiftval, shiftval); rectangle.size=self.frame.size; rectangle.size.width-=shiftval*2; rectangle.size.height-=shiftval*2; cgcontextref context = uigraphicsgetcurrentcontext(); cgcontextsetrgbfillcolor(context, 0.0, 0.0, 0.0, 1.0); cgcontextfillellipseinrect(context, rectangle); cgcontextsetlinewidth(context, linewidth); const cgfloat *components = cgcolorgetcomponents([uicolor greencolor].cgcolor); // works expected. //cons

sql server - Need to Create a SQL View from List of Tables -

trying create view tables have same fields different data in them. have table track each of these tables, , track ones active. want view tie active tables in 1 view. say have tables a, b, , c. b , c active, table 1 lists each table , active. form table 1 can table names need view. it escapes me on how on sql server (2008 version) this sound bad design. better store data in 1 table , use partitioning methods access it. here, though, 1 method want: create view abc select a.* cross join (select 1 table1 status = 'active' , tablename = 'a') union select b.* b cross join (select 1 table1 status = 'active' , tablename = 'b') select c.* c cross join (select 1 table1 status = 'active' , tablename = 'c'); i don't recommend approach. intended show possible. chose cross join , because subquery evaluated once , might optimization underlying execution code.

curl - How to test a node.js server from command line -

i programming ios app needs use web service create authentication token. have written node.js server create token. i know use curl test server locally command line can't seem work. here snippet of server code var app = express(); .... app.post('/authenticate', function(req, res) { // create token ...... res.json({ identity_token: jws }); }); var port = process.env.port || 3000; app.listen(port, function(err) { if(err) throw err; console.log('express server running on localhost:%d', port); }); i have tried using following curl command curl -h "content-type: application/json" -x post -d '{"user_id":"user_id","nonce":"nonce"}' http://localhost/authenticate the error receive "failed connect localhost port 80: connection refused" i appreciate or examples on how test server.

java - Sound will not play in JAR file -

i have problem , hope can me. talk doing know what's going on: @ moment i'm trying program litte piece of software can play me music files (mp3 files exact, i'm using jlayer api). i'm working netbeans , have succesfully imported music file in project. if build program , open resulting jar file archive program, can find music file in there. function i'm using goes this: public static string play(string file) { file test = new file(file); try { fileinputstream in = new fileinputstream(test); player pl = new player(in); pl.play(); return "success"; } catch (exception e) { return e.tostring(); } } as can see i'm getting string path name , refactor him can play file. i'm calling function following code (the music file saved in ressources package): mp3.play(getclass().getresource("/ressources/angel.mp3").getpath()) so if start programm via netbeans works fine. if cre

javascript - TypeError: Cannot read property 'match' of undefined at Object.j [as render] (angular-datatables.min.js:6) -

i using angular-datatables.min.js datatable , facing error, tried lot not able resolve. can 1 please me on this? app.controller('dailytasklistcontroller', ['$scope', '$http', 'dtoptionsbuilder', 'dtcolumnbuilder', function dailytasklistcontroller($scope, $http, dtoptionsbuilder, dtcolumnbuilder){ $scope.dtoptions = dtoptionsbuilder.newoptions() .withoption('ajax', { url: 'dailytask/getmorerecord', type: 'get', datasrc: 'data' }) .withoption('processing', true) .withoption('serverside', true) .withpaginationtype('full_numbers'); $scope.dtcolumns = [ dtcolumnbuilder.newcolumn('id'), dtcolumnbuilder.newcolumn('firstname'), dtcolumnbuilder.newcolumn('lastname') ]; }]); and table in have used it, <table datatable="ng" dt-o

c# - Handling double quotes in JSON strings -

we have application knockout , facing problem registers in database have double quotes, caused json parsing fail. here's json not valid due rogue double quote: { "optionsummaries": [ { "id": 110, "name": "option 1", "status": 1, "productgroupnodes": [ { "id": 110, "name": "corporate brand reputation", "status": 2, "waves": [ { "id": 110, "name": "wave 1", "status": 2, "services": [ { "id": 1101, "title": "proposal budget owner service", "

Android - Button not 100% transparent -

Image
i have added following button in xml file: <button style="@style/roundedbutton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:background="@drawable/rounded_button" android:text="say hi" /> the following rounded_button background looks like: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@android:color/transparent" /> <corners android:radius="50dp" /> <stroke android:width="1dp" android:color="#fff" /> </shape> the following roundedbutton style: <style name="roundedbutton" parent="base.widget.appcompat.button"> <item name=&

python - pandas: for each row in df copy row N times with slight changes -

so have dataframe this: n start 1 1 08/01/2014 9:30:02 2 1 08/01/2014 10:30:02 3 2 08/01/2014 12:30:02 4 3 08/01/2014 4:30:02 and need duplicate each row n times, adding 1 hour start each time, this: n start 1 1 08/01/2014 9:30:02 2 1 08/01/2014 10:30:02 3 2 08/01/2014 12:30:02 3 2 08/01/2014 13:30:02 4 3 08/01/2014 4:30:02 4 3 08/01/2014 5:30:02 4 3 08/01/2014 6:30:02 how can within pandas? you use reindex expand dataframe, , timedeltaindex add hours: import pandas pd df = pd.dataframe({'n': [1, 1, 2, 3], 'start': ['08/01/2014 9:30:02', '08/01/2014 10:30:02', '08/01/2014 12:30:02', '08/01/2014 4:30:02']}) df['start'] = pd.to_datetime(df['start']) df = df.reindex(np.repeat(df.index.values, df['n']), method='ffill') df['

Rails partial caching is showing view changes despite no model changes -

following guide "agile web development rails 4." covers caching product catalog re-render products changed. i edited (config/environments/development.rb): config.action_controller.perform_caching = true added code return updated product: (app/models/product.rb) def self.latest product.order(:updated_at).latest end lastly updated store index cache: (app/views/store/index.html.erb) <h1>your pragmatic catalog</h1> <% cache ['store', product.latest] %> <% @products.each |product| %> <% cache ['entry', product] %> <div class="entry"> <%= image_tag(product.image_url) %> <h3><%= product.title %></h3> <%= sanitize(product.description) %> <div class="price_line"> <span class="price"><%= number_to_currency(product.price) %></span> </div> </div> <% e

python - cmap for use with line plot -

Image
i have list of color values (in either of formats: hex ('#ffffff') or rgb (255,255,255) if helps). these colors correspond explicitly line segment between points. plot line collection of line segments via: import matplotlib.pyplot plt import itertools colors = itertools.cycle('#ffffff', '#ffffff', '#ff0320', '#452143', ...) t = (0, 1, 2, 3, ...) var1 = (43, 15, 25, 9, ...) ax = plt.subplot2grid((3,1), (0,0), colspan=3, rowspan=1) ps = [(t,var1) (t,var1) in zip(t, val)] start, end in zip(ps[:-1], ps[1:]): t, var1 = zip(start, end) c = next(colors) ax.plot(t, var1, color=c) however since have color each point prefer set cmap plot. how might accomplish converting list of colors cmap can use when plotting line? as tcaswell says, use linecollection this: import numpy np matplotlib import pyplot plt matplotlib.collections import linecollection # random walk xy = np.cumsum(np.random.randn(1000, 2), axis=0) z = np.l

How does Spring work with apparently no code? -

i trying understand example described here . what puzzling me there apparently no code. run spring-security-samples-insecuremvc-3.2.x within tomcat , form presented interact there no java code whatsoever far can see. can't find form. realize code must in 1 of dependencies baffled @ how works. spring generate/provide default login form if it's configured form-based login , no custom login form configured. sidenote: how create , configure custom login form is, example, explained here: http://docs.spring.io/spring-security/site/docs/3.2.x/guides/form.html (to long copy/pasted here).

Python string formatting - old `%` vs new `str.format` -

new formatting lets this: '{:.<12}'.format('##') - optional fill character. can using old formatting? (i know can fill spaces '%-12s' % '##' ) also, old formatting lets this: '%-*s' % (12, '##') - variable length. can using new formatting? for doing variable length using new-format , can use nesting of replacements - >>> '{:{}<{}}'.format('##','.',12) '##..........' >>> '{:{}<{}}'.format('##','-',12) '##----------' >>> '{:{}<{}}'.format('##','-',20) '##------------------' even spaces fill character - >>> '{:{}<{}}'.format('##',' ',20) '## ' please note not need use nesting of replacements, can directly specify them in format - >>> '{: <12}'.format('##') '## ' you can sp

javascript - MDN example (of Math.random()): could it be parseInt() instead of Math.floor()? -

i reading javascript tutorial , searching functions on mdn website when stumbled across example of math.random() : function getrandomintinclusive(min, max) { return math.floor(math.random() * (max - min + 1)) + min; } while understand math.floor chooses biggest number , erases numbers have decimal values, learnt function called parseint() deletes of numbers after point. so, what's difference between two? couldn't use function getrandominclusive(min, max) { return parseint(math.random() * (max - min + 1)) + min; } instead? got idea while writing question math.floor() might write 5 when it's 4,5 , parseint() write 4, it's not important random number generator understand (if know examples of when important, please tell me!) so, there's still not of difference in case? parseint parses string integer, reading digits @ beginning of string. not appropriate use round number integer. number converted string first, unexpected results: var num =

node.js - Using docker and docker-compose in order to run npm install and bower install -

i trying use docker node image in order run npm install , bower install . here relevant portion docker-compose.yml : node: image: node:0.10.40 volumes: - ./package.json:/package.json - .bowerrc:/.bowerrc - ./bower.json:/bower.json - ./build/npm.tmp/node_modules:/node_modules - ./build/npm.tmp/bignibou-client/src/bower_components:/bignibou-client/src/bower_components command: bash -c "npm install && bower install" ports: - "8888:8888" unfortunately following error node: node_1 | bash: bower: command not found bignibousite_node_1 exited code 127 indicating command not interpreted properly. i have tried using post-script in package.json follows: "scripts": { "postinstall": "/node_modules/bower/bin/bower install" } here .bowerrc : { "json": "bower.json", "directory": "bignibou-client/src/bower_components" } without bower i

c++ - Thread or class error c++11 -

when try compile following code g++ -std=c++11 -pthread following error , have no idea why. #include<thread> using namespace std; void test (){ } int main () { thread t1 (test); t1.join; return 0; } 8:9: error: statement cannot resolve address of overloaded function t1.join; you missing parenthesis in call join : t1.join(); // ^^ live demo

java - Dynamic menu and titles in JSP -

for example, have 2 pages, left menu , use layout tags. tag left menu: <%@tag description="left panel" pageencoding="utf-8" %> <%@taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@attribute name="page" required="true"%> <ul> <!-- dashboard --> <li <c:if test="${page == 'dashboard'}">class="active"</c:if>> <a href="<c:url value='/dashboard'/>"> <spring:message code="navigation.button.dashboard"/> </a> </li> <!-- settings --> <li <c:if test="${page == 'settings'}">class="active"</c:if>> <a href="<c:url value='/settings/'/>"> &l

c# - MultiView and GridView Paging issue -

i have multi view 2 views in it. view1 has grid view , grid-view allow paging ten records. the problem have press page number tow times go page. the first click nothing happen second click grid view goes page issue <asp:gridview id="gridusers" autogeneratecolumns="false" runat="server" allowpaging="true" onpageindexchanging="onpageindexchanging" pagesize="10" cssclass="table table-bordered text-nowrap" onselectedindexchanged="gridusers_selectedindexchanged" onrowdeleting="gridusers_rowdeleting"> <columns> <asp:templatefield headertext="edit"> <itemtemplate> <asp:linkbutton id="linkbutton1" runat="server" cssclass="btn btn-primary btn-xs" causesvalidation="false" commandname="select" text=&qu

Android Watch Face TextClock -

i have android watch face works 12-hour formats. confused how implement 24-hour format based on system preference of phone, using textclock or other method. simpledateformat twelvehour = new simpledateformat("h:mm a", locale.us); string timeampmnosec = string.format("%s", twelvehour.format(cal.gettime())); canvas.drawtext(timeampmnosec, (centerx - (timexlength / 2.0f ), timeyoffset, timepaint); that setting bridged phone watch automatically , can on watch app calling dateformat.is24hourformat(context) .

c# - Menuitem gets clicked but who is the parent? -

i'm new c# , wpf can not clever question. i've spent time far , not prepared face following. my code build menu based on data tables. creates menu 2 levels deep. , event handler triggered each time main or sub item selected. trouble should know main item (parent) when sub item (child) clicked. how gain that? current handler: private void menu_click(object sender, routedeventargs e) { string sub = ""; sub = ((system.windows.controls.headereditemscontrol)(e.source)).header.tostring(); messagebox.show("selection: " + sub, "info", messageboxbutton.ok); } i saw item.tag solution couldn't find way. the headereditemscontrol has parent property. can used retrieve element, menu item child of.

Docker runs of "pip install" and "npm install" on same container overwriting each other -

in docker container, i'm trying install several packages pip along installing bower via npm. seems whichever of pip or npm run first, other's contents in /usr/local/bin overwritten (specifically, gunicorn missing below dockerfile, or bower missing if swap order of from..run blocks). is expected behavior of docker, , if so, how can go installing both pip packages , bower same directory, /usr/local/bin? here's dockerfile: from python:3.4.3 run mkdir /code workdir /code add ./requirements/ /code/requirements/ run pip install -r /code/requirements/docker.txt add ./ /code/ node:0.12.7 run npm install bower here's docker-compose.yml file: web: restart: build: . expose: - "8000" links: - postgres:postgres #-redis:redis volumes: - .:/code env_file: .env command: /usr/local/bin/gunicorn myapp.wsgi:application -w 2 -b :8000 --reload webstatic: restart: build: . volumes: - /usr/src/app/static env_file: .env co

google app engine - Local GAE Datastore is empty after restart on OSX -

i'm building google app engine application go backend + polymer frontend. result, i'm using dispatch.yaml file serve both @ same time. the problem i'm facing datastore empty when restart computer. i've tested on both osx 10.9.5 , 10.10.4. both exhibit same response upon system reboot. windows 7, however, seems hold on data. the documentation suggests data should persist, since i'm not explicitly calling clear. it's not. i've tried set datastore location myself using this: dev_appserver.py --datastore_path=~/go_apps/data ~/go_apps/my_app i'm receiving error: google.appengine.tools.devappserver2.errors.appconfignotfounderror: "/users/anthony/go_apps/my_app directory not contain app.yaml or app.yml obviously, since i'm using dispatch.yaml file, wouldn't. so, since backend , handles data, have app.yaml file, try set there. use command: dev_appserver.py --datastore_path=~/go_apps/data ~/go_apps/my_app/backend that doesn't

javascript - How to use ES6 Fat Arrow to .filter() an array of objects -

i'm trying use es6 arrow function .filter return adults (jack & jill). appears cannot use if statement. what need know in order in es6? var family = [{"name":"jack", "age": 26}, {"name":"jill", "age": 22}, {"name":"james", "age": 5 }, {"name":"jenny", "age": 2 }]; let adults = family.filter(person => if (person.age > 18) person); // throws error (8:37) syntaxerror: unknown: unexpected token (8:37) |let adults = family.filter(person => if (person.age > 18) person); my working es5 example: let adults2 = family.filter(function (person) { if (person.age > 18) { return person; } }); it appears cannot use if statement. arrow functions either allow use expression or block body. passing expression foo => bar is equivalent following block foo => { return bar; } h

nltk - Frequency Distribution Comparison Python -

i'm using python , nltk study texts , want compare frequency distributions of parts of speech across different texts. i can 1 text: from nltk import * x_tagged = pos_tag(word_tokenize(open('/users/x.txt').read())) x_fd = freqdist([tag word, tag in x_tagged]) x_fd.plot(cumulative=true, title='part of speech distribution in corpus x') i've tried add without luck. i've conditional frequency distribution example comparing count of 3 words across several texts, instead i'd lines represent 4 different texts, y-axis represent counts , x-axis represent different parts of speech. how compare texts y , z in same graph? the freqdist.plot() method convenience method. you need write plotting logic (using matplotlib ) include multiple frequency distributions in 1 plot. the source code of plotting function of freqdist might god point started. matplotlib has tutorial , beginners guide.

excel - VBA: assign specific values if two conditions are met -

Image
i have following table: column a: time stamps column b-d: different values column e: indicators column g: converted time stamps calculate (min sec) i need assign different values indicators (column f). first sequence xyz gets 1, second 2, ect. shown in image. however, if gets more complicated can have missing values. for example rows 11 17 might not exist , indicator left z (which gets 2 assigned). in worst case, rows 11 20 missing. next sequence 3 needs assigned. thus, somehow need work column "g" due missing values time stamp 'jumps' indicator in column "i". i tried use if functions 1 if indicator or time changes. combine , how can work in loop... does know deal or has idea? in actual table have around 12 rows per second. gives >16,000 rows per file. after assignment goal make pivot table different values , assignments (this works already).

java - GC overhead limit exceeded when reading large xls file -

when run project in netbeans ide (compiling , testing it), works fine. enables me reading xls file size of 25000 rows , extract infromation above, save them database. the problem appears when generate installer , deliver it. when install application , run it, obtain error: java.lang.outofmemoryerror: gc overhead limit exceeded @ jxl.read.biff.file.read(file.java:217) @ jxl.read.biff.record.getdata(record.java:117) @ jxl.read.biff.cellvalue.<init>(cellvalue.java:94) @ jxl.read.biff.labelsstrecord.<init>(labelsstrecord.java:53) @ jxl.read.biff.sheetreader.read(sheetreader.java:412) @ jxl.read.biff.sheetimpl.readsheet(sheetimpl.java:716) @ jxl.read.biff.workbookparser.getsheet(workbookparser.java:257) @ com.insy2s.importer.semapexcelimporter.launchimport(semapexcelimporter.java:82) at//staff i user poi libraries got same scenario. update: in messages.log file of application, found strange values (i have changed them in netbea

javascript - Image Onload - Quickbase -

i'm trying follow dan diebolt's 'image onload" technique inject custom js script think i'm tripping @ first part - process says: create field following formula definition , include in form/report. so i've created text-formula field named '-', allowed html , pasted formula in "formula" section of field: [-]= "<img qbu=\"module\" src=\"/i/clear2x2.gif\" " & "onload=\"javascript:if(typeof qbu=='undefined'){qbu={};$.getscript('" & urlroot() & "db/" & dbid() & "?a=dbpage&pagename=module.js&rand='+math.random())}\">" when attempt save alert says "a formula may not contain reference directly or indirectly through formula." doing wrong? i've tried adding field form anyway , doesn't seem anything. these steps i'm following: [ https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&r

memory management - C++: What happens to a dynamically allocated object created as an argument in a constructor call? -

say making new object of class foo, takes object of class bar constructor argument. if created object in manner: foo myobj(new bar()); what happens in case new object? i've seen code similar example (with no name new object created argument). put delete call free memory taken bar object? it depends, if allocated in example, foo class managing it, otherwise bar leaked class foo { public: foo(bar* bar) : m_bar{bar} {} ~foo() { delete m_bar; } private: bar* m_bar; }; or if have access c++11 have std::unique_ptr class foo { public: foo(bar* bar) : m_bar{bar} {} private: std::unique_ptr<bar> m_bar; };

Html table cells not responsive on iphone emails -

i'm setting html template client having fun tables, yay. responsiveness previews correctly in desktop browser, when sent iphone, td's not scaling percentage applied, defaulting content size. example i've supplied images (trying setup nav template), applies text well. the goal 600px centered content area background of email light gray. under 600px, nav cells should responsively scale 25% of viewport, text content cells shrink text size, , images expand image size. anyone know way on iphones set table cell widths percentage of viewport? <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1 user-scalable=no"> <style> .wrapper { width: 100%; text-align: center; background-color: #ebebeb; } .container {

python - Unpacking dictionary into model -

when unpacking ** need have same arguments constructor? what mean is, if have additional item in dictionary, should ignored, need pop item? trying unpack everything, , expecting item excluded, getting error: __init__() got unexpected keyword argument nagative = negativesentimentanalysis(**negative_items) class negativesentimentanalysis(db.model): id = db.column(db.integer, primary_key=true) sentiment = db.column(db.string(500)) topic = db.column(db.string(500)) def __init__(self, sentiment=none, topic=none): self.sentiment = user_id self.topic = topic you can have __init__ accept keyword arguments: def __init__(self, sentiment=none, topic=none, **kw): this cause leftover arguments collected in kw method can ignore. however, comes caveat may have other code construct object may need fail. alternatively filter out arguments noted in other answer.

php - Git Commands not working -

Image
i using latest version of git in bash , trying execute basic commands e.g php . have set environment variable c:\wamp\bin\php\php5.5.12 in path . however when execute these basic commands nothing comes up, not sh.exe: command not found . if have suggestions please let me know. you have add environment variable php. can say: gitbash have know command installed. php, see below: right click computer click properties go advanced system settings left navigation click on environment variables... button go system variables below select path, click edit , in beginning of path enter: c:\pathtoyourphpdir\bin; (please note in here should indicate php executable path. in case installed php via e.g. windows installer). related question: git bash giving sh.exe: ruby: command not found

css - Multiple media queries for different sizes not working -

i working on making site responsive , able respond medium / large table sizes using following media query: @media (max-width: 1280px) { .nav-tab { display: none; } .nav-drawer-button { display: block; float: left; padding-top: 30px; margin-left: 80%; cursor: pointer; } .panel-title { width: 40%; font-size: 24px; } .panel-text { width: 70%; } .footer-text { padding-top: 15px; } .social:first-child { margin-right: 1em; } } there problem on screens 600px - 650px in size created query after 1 looking like: @media (min-width: 600px) , (max-width: 650px) { .nav-drawer-button { margin-left: 70%; } } this doesn't appear work. applies first media query. tried changing order of queries, did not work. doing wrong? here whole css: @import url(http://fonts.googleapis.com/css?family=roboto:500); @import url(http://fonts.googl

xcode - Using Swift with an OS X Preference Pane plugin -

Image
i'd use swift build os x preference pane plugin system preferences app, can't work. after clicking "next" xcode template doesn't offer option choose swift language, automatically creates project in objective-c. without adding code or doing else, project builds successfully. if right-click on product , select "open in external editor", system preferences install , load preference pane. it works! well that's great, now, want add new cocoa subclass using swift. accepting default, , allowing create bridging header. now, quit system preferences , without adding code , rebuild project. before, right-click product , "open in external editor". system preferences confirm replacing preference pane, , install it, fails load. if show built product in finder, in addition .prefpane plugin, there's .swiftmodule folder. i'm guessing there's missing in build phases or build settings that's respon

c++ - Check Writer Function challenge -

saluton mundo, i've been working on function prints lettering on check based upon numbers. problem made void, , have no clue how convert void-> string. impossible if ask me. in short, how can rewrite returns string. my code below: void numalet(string &can) { int connum= atoi(can.c_str()); float connumf= atof(can.c_str()); //snippet find cents. float cen= (int)((connumf- connum)* 100); string basic[20]= { " ", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"}, diez[9]= { "ten", "twenty", "thirty", "forty", "fifty", "sixty", &q

python - Odoo 8.0 product_product inherit extend class -

i'm getting first step odoo. i'm trying extend product model class this. from openerp.osv import osv,fields fields class product_product(osv.osv): _name = 'product.product' _inherit = 'product.product' _columns = { 'products_ids':fields.one2many('product_application.version', 'version_id', string="versions") } and getting following error file "/home/nano/archivos/pycharmprojects/odoo/odoo/openerp/models.py", line 596, in _build_model original_module = pool[name]._original_module if name in parents else cls._module file "/home/nano/archivos/pycharmprojects/odoo/odoo/openerp/modules/registry.py", line 102, in __getitem__ return self.models[model_name] keyerror: 'product.product' can point me complete odoo v8 documentation, official poor you getting 'keyerror' so please check whether gave correct depends in openerp .py ie, have give '

ios - Sending message to WhatsApp from your app using Swift? -

for 1 of app, wanted share data whatsapp contacts. tried few solutions overs stackoverflow couldn't exact solution. after trials achieve looking for, sharing here anyone's future reference. var url = nsurl(string: "whatsapp://send?text=hello%20friends%2c%20sharing%20some%20data%20here...%20!") //text shared on whatsapp is: "hello friends, sharing data here... !" if uiapplication.sharedapplication().canopenurl(url!) { uiapplication.sharedapplication().openurl(url!) } note: text needs url encoded. can using of open source tools on internet or using stringbyaddingpercentencodingwithallowedcharacters function in ios. e.g. var urlstring = "hello friends, sharing data here... !" var urlstringencoded = urlstring.stringbyaddingpercentencodingwithallowedcharacters(.urlhostallowedcharacterset()) var url = nsurl(string: "whatsapp://send?text=\(urlstringencoded!)")

.htaccess - 301 Redirect for website tonight mobile? urls on Apache -

i have long list of urls this: http://example.com/site/mobile?url=http%3a%2f%2fwww.example.com%2furl_begins_here.html and no matter do, can't urls go new pages. any ideas, i'm dying here. i figured out: rewritecond %{query_string} url_begins_here.html rewriterule .? http://example.com/new-url-goes-here.html? [r=301,l]

Android Service or IntentService for app like whatsapp? -

i developing chat app. when user connects internet, server pushes message notifications him. should use service or intentservice new message notifications? service/intentservice must start on boot , never stop, if close app. i expect if using own push notification system, it's based on keeping connection/socket open backend. you'll have on background thread because android doesn't allow network operations on main thread. intentservice queues start commands (issued via context.startservice() ) , executes them serially on background thread; once queue exhausted stops automatically. useful performing relatively short-lived tasks off main thread , in context less erratic lifecycle activity. doesn't sound best fit must alive, think should stick regular service , manage own worker thread keep network operations in background.

java - How is it possible to run swagger2markup from .sh script? -

is there way start asciidoc(or other doctype)-generation .json files using swagger2markup in .sh-file? i know possible ( look there ) create java class swagger2markup has function, want run programm directly out of .sh - file without creating new artifacts. have @ https://swagger2markup.readme.io/docs/cli . command line interface (cli) swagger2markup.

eclipse - Error compiling a java into ,class (goto) -

this first time editing program made in java, know how program in php, problem i'm editing program done in java, done dedicated myself add few lines of code extend capabilities (copy , paste ) have webscraper.class file , decompile , convert java edit ,when compile following error: i tested eclipse , when give run nothing , tried changing version of jdk , nothing tried on computer , still nothing , i've been reading on previous responses due "goto " have not managed fix , since not know how part must programmed compiled. appreciate help, or tell me how use eclipse or put fix mistakes have. c:\users\tecnicom\downloads\prog>javac webscraper.java webscraper.java:99: error: illegal start of expression if (i >= 3) goto _l2; else goto _l1 ^ webscraper.java:99: error: not statement if (i >= 3) goto _l2; else goto _l1 ^ webscraper.java:99: error: 'else' without 'if' if (i &g

parse a complex json object in java which has some int value in one node -

plz me parse below json.i getting json 1 source problem has 1 int value in 1 of node item id value. "28": { , "44": { there @ node position , not able parse it. { "request": { "target": "some target", "format": "json", "service": "some service", "version": "2" }, "response": { "status": 1, "httpstatus": 200, "data": { "28": { "offer": { "id": "28", "name": "some name", "description":"some data", "url": null, "url2": null, } }, "44": { "offer": { "id": "44", "name": "some name", "description":"some data&qu

php - Laravel - Allow only the owner of the note to view it and edit it: Middleware or FormRequests? -

imagine personal notes app. users can add, view , edit own notes, not notes belong other users. the notes accessed way: app.dev/notes/{id} so naturally, if own note has id of 140 , change id 160 in url, able view note. i want prevent happening. thought of using middleware this, i've read people saying shouldn't use middleware because isn't flexible, , should use formrequests instead. the problem is, don't understand how use formrequests in case. i've used formrequests prevent user editing note doesn't belong them. if own note id of 140 , , try edit/post note id of 160 , form request won't let me it. but formrequest doesn't prevents me viewing note id of 160 . can please point me right way of doing this? thank you you can use policy. cleaner , easier way authorization. authorization policy : laravel after creating , registering policy can public function access(user $user, note $note) { return $user->id === $note