Posts

Showing posts from March, 2013

HTML Form not "Posting" user input values to PHP POST Arrary. I am trying to email a form -

HTML Form not "Posting" user input values to PHP POST Arrary. I am trying to email a form - seemingly simple issue: have html form: <form action="submit.php" method="post" enctype="text/plain"> <h3>owner information</h3> first name*: <br /> <input type="text" name="firstname" /><br /> lastly name*: <br /> <input type="text" name="lastname" /><br /><br /> owner on title?*: <br /> <input type="radio" name="titleowner" value="yes" />yes <input type="radio" name="titleowner" value="no" />no<br /><br /> </form> and here submit.php: <?php $admin_email = "aloha@hi.com"; $email = "hey@gmail.com"; $subject = "subject";

python json parsing error -

python json parsing error - i wrote simple programme parse json: #! /usr/bin/env python import urllib2 import json = 'https://api.stackexchange.com/2.2/users/507256?order=desc&sort=reputation&site=stackoverflow' j = urllib2.urlopen(so) print j.read() j_obj = json.loads(j.read()) it fails next output: traceback (most recent phone call last): file "./so.sh", line 12, in <module> j_obj = json.loads(j.read()) file "/usr/lib/python2.7/json/__init__.py", line 338, in loads homecoming _default_decoder.decode(s) file "/usr/lib/python2.7/json/decoder.py", line 365, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) file "/usr/lib/python2.7/json/decoder.py", line 383, in raw_decode raise valueerror("no json object decoded") valueerror: no json object decoded any thought doing wrong? you cannot read response twice. remove print line, or store result of j.read()

icheck-rails gem for Rails4 -

icheck-rails gem for Rails4 - i running issue while integrating gem, in this url there section says: icheck includes several skins, of them multiple color schemes. include them this: @import 'icheck/square/blue' @import 'icheck/square/green' i tried add together above line in end of app/assets/stylesheets/application.css style not effecting. behind scene javascript working fine , rendering below given html: <div class="icheckbox_square-blue" style="position: relative;"> <input type="checkbox" data-color="blue" data-skin="square" class="icheck-me" style="position: absolute; opacity: 0;"> <ins class="icheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: none repeat scroll 0% 0% rgb(255, 255, 255); border: 0px none; opacity: 0;"></ins> </div>

audio - Java - How to stop an audioclip from another class -

audio - Java - How to stop an audioclip from another class - right now, i'm making app involves background audio, , couple of tips other's questions , answers, able create sound work. but right now, i'm trying utilize button in different class stop audioclip, instantiated in class. when tested prototype, in same class, worked perfectly. but in main app, "stop" button in different class (for reason). don't know if you'll want code main app, here's prototype described: help appreciated, thanks. public class audioplay { clip clip; // constructor public audioplay() { seek { this.clip = audiosystem.getclip(); } grab (lineunavailableexception ex) { logger.getlogger(audioplay.class.getname()).log(level.severe, null, ex); } jframe f = new jframe(); f.setdefaultcloseoperation(jframe.exit_on_close); f.settitle("test sound clip"); f.setsize(300, 2

sql server - T-SQL Unique Identity Column as Part of Composite Primary Key -

sql server - T-SQL Unique Identity Column as Part of Composite Primary Key - suppose have table next structure: create table [log] ( [type] int not null, [stat] nvarchar(20) not null, [id] int identity (1, 1) not null, descr nvarchar(20), primary key ([type], [stat], [id]) ) is possible forcefulness [id] incremented whenever other 2 pk fields have same values, , not independently now? instance: type stat id descr 5 error 1 test <--- 3 warning 1 test 5 error 2 test <--- 2 error 1 test 1 warning 1 test 5 warning 1 test 5 error 3 test <--- no. purpose of identity (or sequence) generate incremental integer. there may gaps values not reused, , values may reserved not used. you can utilize look in queries show desired value. row_number() on (partition type, stat order id) seq sql sql-server tsql primary-key composite-pr

express - Condition for req.flash inside Jade template (Sails) -

express - Condition for req.flash inside Jade template (Sails) - inside sails.js application, passing flash messages within jade templates. want display these messages within <section> html5 tag, don't want tag nowadays if there no flash message. here jade code : - var flash = req.flash('error') if error || !!flash section.err= error | #{flash} but doesn't work: displays right flash messages, puts everytime <section> tag (even if flash var contains no message). node : req.flash('msgtype') flushed @ every call, had set within variable. i have found how manage this, testing flash 's length : - var flash = req.flash('error') if error || flash.length != 0 section.err= error | #{flash} inspired https://github.com/balderdashy/sails/issues/1054#issuecomment-29045509 express jade connect sails.js connect-flash

C# college project enumeration -

C# college project enumeration - i making easy calculator refresh starting college again. every thing working fine except trying assign keyboard ie. press plus adds, minus subtracts. but when come in number , press add together button every thing right not clear text box of plus sign. why this? private void tbone_keydown(object sender, keyeventargs e) { if (e.keycode == keys.add) { total1 += double.parse(tbone.text); tbtwo.text = tbone.text + btnplus.text; tbone.clear(); plusbuttonc = true; minusbuttonc = false; dividebutton = false; multiplybutton = false; } } you need indicate event have handled key press prevent keypress beingness passed standard windows event handler. suppresskeypress prevent key beingness added text box. add together these lines: e.handled = true; e.suppresskeypress = true; it's worth noting setting suppresskeypress sets h

haskell - Cabal install pcre-light on windows. Extra-include-dirs/extra-lib-dirs not working -

haskell - Cabal install pcre-light on windows. Extra-include-dirs/extra-lib-dirs not working - i'm using mingw+msys, i've added extra-include-dirs, extra-lib-dirs, nil seems helping cabal find pcre library. here command lines i've tried, , sample output below it. cabal install pcre-light --extra-include-dirs='c:\program files (x86)\gnuwin32\include' --extra-lib-dirs='c:\program files (x86)\gnuwin32\lib' cabal install pcre-light --extra-include-dirs='/c/program files (x86)/gnuwin32/include' --extra-lib-dirs='/c/program files (x86)/gnuwin32/lib' cabal install pcre-light --extra-include-dirs="/c/program files (x86)/gnuwin32/include" --extra-lib-dirs="/c/program files (x86)/gnuwin32/lib" and maintain getting along these lines: resolving dependencies... notice: installing sandbox located @ c:\users\user\src\dbsite\dbsite\.cabal-sandbox configuring pcre-light-0.4.0.3... failed install pcre-light-0.4.0.3 lastly

android - How to change option menu icon in the action bar? -

android - How to change option menu icon in the action bar? - how alter index icon of alternative menu? i mean icon (3). here code: @override public boolean oncreateoptionsmenu(menu menu) { menuinflater inflater = getmenuinflater(); inflater.inflate(r.menu.options, menu); homecoming true; } and here xml file: <item android:id="@+id/bugreport" android:title="@string/option_bugreport" /> <item android:id="@+id/info" android:title="@string/option_info" /> <item android:id="@+id/about" android:title="@string/option_about" /> <!-- application theme. --> <style name="apptheme" parent="appbasetheme"> <!-- customizations not specific particular api-level can go here. --> <item name="android:actionoverflowbuttonstyle">@style/myactionbuttonoverflow</item> </style> <!-- style re

jquery - Call javascript function multiple times -

jquery - Call javascript function multiple times - so, i'm having troubles finding way solve problem. know seems silly, i'm stuck on this. i have like: <div class="tdate"> sat oct 11 01:11:01 +0000 2014 </div> <div class="tdate"> sat oct 11 01:10:44 +0000 2014 </div> <div class="tdate"> sat oct 11 00:51:03 +0000 2014 </div> and javascript function: function parsetwitterdate(tdate) { var system_date = new date(date.parse(tdate)); var user_date = new date(); if (k.ie) { system_date = date.parse(tdate.replace(/( \+)/, ' utc$1')) } var diff = math.floor((user_date - system_date) / 1000); if (diff <= 1) {return "just now";} if (diff < 20) {return diff + " seconds ago";} if (diff < 40) {return "half min ago";} if (diff < 60) {return "less min ago";} if (diff <= 90) {return "o

java - How can we write to a printer in GAE? -

java - How can we write to a printer in GAE? - we porting our application on gae , 1 of options has render printer? possible in gae (being in cloud may not have concept of printers). if so, how done? (google search not appear show anything.) thanks - dave we have used google cloud print in office before can configure printers , share them using google cloud print. here list of cloud ready printers. there seems api cloud print believe can explore calling gae servers using url fetch service, authentication managed using oauth2 can utilize oauth2 client libraries. i think first step check if need maintain existing printers , if can added google cloud print, if possible can explore using cloud print apis gae app, see next links in docs: https://developers.google.com/cloud-print/docs/proxyinterfaces https://developers.google.com/cloud-print/docs/devguide if printers not back upwards cloud print unfortunately might have develop , expose own api accepts jobs , sends

c# - Can't get my code for getContinuation working -

c# - Can't get my code for getContinuation working - i trying retrieve entire list of info odata source, can't seem getcontinuation working... code have far follows: var nwd = new odataservicereference.northwindentities(new uri("http://services.odata.org/northwind/northwind.svc/")); var res1 = nwd.orders //response .orderby(o => o.orderid) .select(o => new { o.orderid, o.customer.companyname, o.customer.contactname, o.employee.firstname, o.employee.lastname, o.order_details }) dataservicequery; var response = (queryoperationresponse<order>) nwd.execute<order>(new uri(res1.tostring())); //var response = res1.execute() queryoperationresponse<odataservicereference.order>; var res1list = new list<order>(response); dataservicequeryc

google apps script - Adding guests to calendar event -

google apps script - Adding guests to calendar event - i have script adds guests event spreadsheet, adding first invitee loop. logger shows list of people, yet 1 gets added in calendar. here code: for (var = 0; < registrationdata.length; i++) { var session = registrationdata[i][0]; var email = registrationdata[i][2]; var eventid = session.tostring().replace("@google.com",""); var event = calendar.events.get(sharedcalendar, eventid); var add together = calendarapp.getcalendarbyid(sharedcalendar).geteventseriesbyid(session).addguest(email); i create link new calendar advanced services goes out in email, yet message event deleted users calendar. because aren't beingness added invitee first? var link = calendar.events.get(userscalendar, eventid).htmllink; thanks can help! edit: new working loop serge's fabulous help (var = 0; < registrationdata.length; i++) { var guestemail = registrationdata[i][2

Reading meta and starting playback of m4a-files is very slow on Android -

Reading meta and starting playback of m4a-files is very slow on Android - i utilize mediametadataretriever retrieve meta info m4a-files on android device. here code execute. final mediametadataretriever mmr = new mediametadataretriever(); mmr.setdatasource(new file(root, audiofile).getabsolutepath()); string title = mmr.extractmetadata(mediametadataretriever.metadata_key_title); string album = mmr.extractmetadata(mediametadataretriever.metadata_key_album); string artist = mmr.extractmetadata(mediametadataretriever.metadata_key_artist); mmr.release(); the problem when phone call code mp3-files, fast. instance, 25 mp3-files analysed in under 900ms time. but if phone call single m4a-file, same code requires 6 seconds execute. , slow. another observation is, when utilize android mediaplayer mp3 file starts playing immediately, while between starting m4a-file , first sound there same 6 seconds delay. i tried different android versions , different devices. there same

javascript - jQuery wrap label around plain text -

javascript - jQuery wrap label around plain text - i want wrap label around plain text doesn't have target it. for example, this: <div class="checbox"> <input type="checkbox"> text </div> should become: <div class="checbox"> <input type="checkbox"> <label>some text</label> </div> if modify html trivial, cannot. with jquery how wrap "some text" label? if html construction constant then, want wrap lastly kid of div class checkbox class="snippet-code-js lang-js prettyprint-override"> $($('.checbox')[0].lastchild).wrap('<label />') class="snippet-code-css lang-css prettyprint-override"> label { color: reddish } class="snippet-code-html lang-html prettyprint-override"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js&quo

Using arguments with a PHP script in HTML -

Using arguments with a PHP script in HTML - how can pass argument php script in this: <?php require '../scripts/listpictures.php'; ?> adding argument @ end causes whole script break , using vardump on argv returns null. you don't send arguments because include/require runs script if wrote in place. so check parameters script needs (something in session? on request? variable perhaps?) , set before require. a improve approach turn whatever within listpictures.php function, send parameters alban reply much little. creating class, instancing it, calling it, simple task =p rather either create function within that, since it's easier, cleaner, faster (both , php run) , uses less memory php

html - element width:100% not working with container/container-fluid -

html - element width:100% not working with container/container-fluid - im trying create image header total width , image take container width , not 100% width (even if set div outside container). have tried , nil worked , answers here didnt help. may done if alter .container width in custom css ruin entire site design. code: <body style="background-color: #eee"> <div class='container-fluid'> <div class="row" style='width: 100%'> <div class='' style='height: 10px; margin: 0 0;padding: 0 0 ; width:100%'> <img class='' src="images/shape1.png" style='height: 100%; width:100%; margin-bottom: 13px'> </div> </div> <div class='row text-center rowstyle' > <img id='leftlogo' src="images/kslogo.png"> <img id='r

How to logout of Intellij's TeamCity plugin -

How to logout of Intellij's TeamCity plugin - i've logged teamcity plugin intellij thought 13.1 using teamcity admin credentials, shared amongst team. i'd login using own business relationship can configure watches, can't work out how log out of plugin. how do this? there's tiny little icon in bottom right of intellij window (for me it's next lock icon toggling read-only mode in current buffer) allows logout. intellij-idea teamcity

merge - Add observations found in a data frame to a much larger data frame in R -

merge - Add observations found in a data frame to a much larger data frame in R - i need update big info frame (a) several times day smaller info frame (b). both info frames share same number of variables , same construction of column classes. difference number of observations , observations themselves. i've spent hours on site , others trying figure out solution. got merge() work little info frames (313 observations of 96 variables each). merge(a,b,all=t) however, when seek run same operation on larger info frame (~1.5 1000000 observations of 96 variables), error: cannot allocate vector of size 1.6 gb. i have ~12 gb of free physical memory according windows task manager. starting gc() function create sure have amount of memory possible, still won't work. there function add together observations existing info frame? tried few others, result wasn't info frame same structure. if can't tell already, i'm new r (and fo

testing - JMeter, what is meant the resulting graphics? -

testing - JMeter, what is meant the resulting graphics? - i have next settings: number of threads(users): 10 rump-up period(in second): 0 target throughput (in samples per minute): 40.0 and can not understand meant resulting graphics ten points in each sample, on graph throughput, represent 10 threads(users)? why distance between points in each subsequent sample becomes smaller? why when rump-up period=0, graph of throughput intermittent , decreasing? when rump-up period>1, graph of throughput smooth , increasing: so throughput stated @ bottom, average 400/min @ 10 users, 40/user. greenish dots show this. first graph shows throughput had steep climb, dropped off after first 10 requests, climbed again, etc. until leveled out average. no scale shown on graph, average stated. average showing when server sent 10 requests, takes longer 'spin up' , settle in when first 10 requests sent gradually. cause exclusively dependent on environment , architecture

tic tac toe - Python How to keep score in a tic tac toe game -

tic tac toe - Python How to keep score in a tic tac toe game - i need help figuring out how calculate record wins, losses, , ties. right now, code returns string "loss" when player loses. want homecoming 1, 1 loss. can help? here code have far. # tic tac toe import random def score(): wins = 0 losses = 0 ties = 0 def result(wins, losses, ties): if result =='win': wins += 1 if result == 'loss': losses += 1 else: ties += 1 def drawboard(board): # function prints out board passed. # "board" list of 10 strings representing board (ignore index 0) print(' | |') print(' ' + board[7] + ' | ' + board[8] + ' | ' + board[9]) print(' | |') print('-----------') print(' | |') print(' ' + board[4] + ' | ' + board[5] + ' | ' + board[6]) print(' | |') print('

java - Handling an exception as a method argument -

java - Handling an exception as a method argument - i looking design pattern handle exception instances received method arguments. to set context question, using gwt , have various asynchronous handlers come in form similar to: public interface asynccallback<t> { void onfailure(throwable caught); void onsuccess(t result); } so, onfailure method receives throwable instance need handle. now, have number of exceptions can receive in method, example constraintviolationexception timeoutexception nosuchelementexception in handling code of course of study write following: void handleexception(final exception e) { if(e instanceof timeoutexception) { handletimeout(); } else if (e instanceof nosuchelementexception) { handleinvalidelement(); } else { stopandcatchfire(); } } but eye, looks ugly. big if..else if chain combined heavy usage of instanceof seems should avoided. i thought maybe utilize try...cat

excel - Sum into aggregate rows based on duplicate column value -

excel - Sum into aggregate rows based on duplicate column value - i have big info set looks this: 239617920 0 1 1 1 239617917 0 1 1 1 239617911 1 1 0 1 239617911 1 0 0 1 239617890 0 0 0 1 239617885 1 1 0 1 for each row, want able sum values of columns b, c, d, , e if column values equal, 1 aggregate row. therefore, want output 239617920 0 1 1 1 239617917 0 1 1 1 239617911 2 1 0 2 239617890 0 0 0 1 239617885 1 1 0 1 since have 239617911 listed twice. is there way in excel? pivot tables great this, it's not hard same thing using formulas. assuming info starts in cell a2, come in next in g2, , re-create downwards many rows needed: =small(a:a,countif(a:a,"<="&g1)+1) enter next in cell h2, , re-create other summary cells: =sumif($a:$a,$g2,b:b) excel

python - Win32 exception occurred when using pythoncom.CoUninitialize() and wmi -

python - Win32 exception occurred when using pythoncom.CoUninitialize() and wmi - i trying create create function in python 3.4 ping server. needs work on windows (possibly xp , above). i have found can utilize wmi win32_pingstatus (reference) class ping server , have written next function: import sys if sys.platform.startswith('win32'): import wmi import pythoncom def ping(ip_address): """ check if can ping ip address using os ping tool""" if sys.platform.startswith('win32'): try: pythoncom.coinitialize() c = wmi.wmi() status_code = c.win32_pingstatus(address=ip_address)[0].statuscode if status_code == 0: successful = true else: successful = false pythoncom.couninitialize() except wmi.x_wmi: # if wmi ping fails fallback pass else: raise notimplementeder

recursion - Issue with recursive function in javascript -

recursion - Issue with recursive function in javascript - i practicing using recursive functions solve simple javascript problems. i running issue next code, var locate = function(arr,value){ (var i=0; <arr.length; i++) { if(typeof arr[i]=== "string") { console.log("string string"); if(arr[i]=== value) { console.log("this should true"); homecoming true; } } else { locate(arr[i], value); } } } console.log(locate(['d', 'a',['e', 'g']], 'e')); i cannot programme homecoming true. gets right part of code, prints statement above it. any help appreciated. have been banging head @ couple of hours now. edit-@matt burland pointed out fact need include homecoming statement when calling recursive. when recurse, need return value returned recursive phone call unwind. so in e

java - Android closes on login screen when backspace pressed on login activity -

java - Android closes on login screen when backspace pressed on login activity - the application working on has login page users set in credentials, , log in. for reason, if user presses backspace key while typing password, application closes phone's main screen. the logcat result shown upon press is: 4332-4332/com.etc.etc w/iinputconnectionwrapper﹕ showstatusicon on inactive inputconnection i looked around not find prepare - maybe missing something. thank you! edit: i have found code responsible this. don't know previous developer had in mind, after commenting out there no more issues. @override public boolean onkeydown(int keycode, keyevent event) { finish(); homecoming super.onkeydown(keycode, event); } back button, default, finishes activity. if don't want finish, override press function: @override public void onbackpressed() { //do whatever want or nil } java android

why3 - Launching Frama-c neon with jessie -

why3 - Launching Frama-c neon with jessie - i have installed frama-c , why3 when seek launch frama-c error jessie3. frama-c -verbose 2 [kernel] warning: cannot load plug-in `jessie3' (incompatible neon-20140301). exact failure is: error loading shared library: /usr/local/lib/framac/plugins/jessie3.cmxs: undefined symbol: camlgzip i have not found info camlgzip can error in config file (it can camlzip) havent foud declared. edit: have tried modifie camlgzip in camlzip in jessie3.cmxs create segmentation fault when launch frama-c my frama-c , why3 versions : frama-c -version version: neon-20140301 why3 --version why3 platform, version 0.85 (build date: wed oct 29 10:42:47 cet 2014) i work on mint17 virtual machine , had no error in ./configure , create of each program i hope had problem , can help me i ran problem , kind of fixed it. have install why-2.34 have jessie installed frama-c lib. download link:https://opam.ocaml.org/packages/why/why.2.34/

eclipse - Regarding Maven -

eclipse - Regarding Maven - i new maven , if sense asking basic question please forgive me. i facing couple of problems maven mentioned below. i using eclipse luna 4.4.1 (which comes maven plugin).now installed 2 plugins..out of 1 subclipse(with svnkit) , m2e-subclipse used integrating maven svn.i downloaded project in eclipse using svn plugin "checkout maven project" , see project beingness downloaded , remove errors related pom.xml downloaded maven , given local path of maven in preferences > maven > installations , changed global settings , user settings files project specific. 1). after doing circus still can not see maven build options in eclipse. 2). not able clean project command prompt. when go project directory , type "mvn -version" shows me right version of maven. but when seek clean using mvn clean. not work. please help. regards. eclipse maven svn

C# printing for loop -

C# printing for loop - i want print this:- 1 121 12321 1234321 123454321 this programme prints this. error in programme ? in loop ? please tell me how prepare this. error in logic using. if so, problem in logic ? how should think algorithms in near future ? :- 1 12 123 123432 123454321 using system; using system.collections.generic; using system.linq; using system.text; namespace consoleapplication1 { class programme { static void main(string[] args) { int a, b, c, d, e; b = 6; for(a=b;a>=1;a--) { (c = a; c >=1; c--) { console.write(" "); } for(d=1; d<=b-a;d++) { console.write(d); } (e = b-a-1; e>=a; e--) { console.write(e); }

windows 7 - Best strategy for installing cygwin under restrictive IT policies? -

windows 7 - Best strategy for installing cygwin under restrictive IT policies? - my organization has grouping policy in effect allow executable programs reside under programme files (or programme files x86) directory. obviously, these directories not writable normal users. have access local admin rights, can install things there if want. of course of study doesn't create sense set whole cygwin tree there, since users need able write /home, /tmp, etc. thinking might able links, maybe install c:\cygwin, move /bin directory under programme files , create hard link it? has run similar situation , come elegant solution? win 7 enterprise. prior cygwin 1.7.34, solving such problems required fair bit of hoop-jumping,¹ it's easy: if haven't installed cygwin yet, so.² if have cygwin installed , started version of cygwin prior 1.7.34, move /etc/passwd , /etc/group out of way,³ upgrade current version. start cygwin terminal. open cygwin's /etc/nsswitch

ruby on rails - Why does my extracted/scraped HTML code render as text? -

ruby on rails - Why does my extracted/scraped HTML code render as text? - i want extract search form, this webpage, , render on "static_pages/home" page of rails app: codepen illustration of "static_pages/home" steps taken: i created next ruby script verify extract form: require 'nokogiri' require 'open-uri' url = 'http://websoc.reg.uci.edu/perl/websoc' info = nokogiri::html(open(url)) form = data.xpath('//form[@action="http://websoc.reg.uci.edu/perl/websoc"]') puts form shifting on rails, included nokogiri , openuri in gem file , used bundle install gems. i created staticpages controller: class staticpagescontroller < applicationcontroller def home require 'nokogiri' require 'open-uri' url = 'http://websoc.reg.uci.edu/perl/websoc' info = nokogiri::html(open(url)) @form = data.xpath('//form[@action="http://websoc.reg.uci.edu/perl/websoc"]')

java - How to generate a file with current Day's hour with minute upto current time using Calendar -

java - How to generate a file with current Day's hour with minute upto current time using Calendar - how generate file current day's hr min upto current time.using calendar in java for illustration if time 02:28, want hr , min below. output: 00:00 00:01 00:02 00:03 . . . . 02:28 try code: filewriter filewriter = new filewriter("myfile"); calendar = new gregoriancalendar(); calendar c = new gregoriancalendar(); c.set(calendar.hour_of_day, 0); c.set(calendar.minute, 0); dateformat df = new simpledateformat("hh:mm"); while (c.before(now)) { c.add(calendar.minute, 1); filewriter.write(df.format(c.gettime())+system.lineseparator()); } filewriter.close(); java calendar

How do I work with a rails 4 collection and determine an object count by enum? -

How do I work with a rails 4 collection and determine an object count by enum? - i have rails 4 app, user owns sales_opportunity, , each sales_opportunity can have "pipeline_status" implemented enum. works fine, trying create user display shows each of these pipeline_status(es) in graphical manner (a series of chevrons lead "prospect" "closed_won") , want display badge on each chevron shows number of opportunities user has within each pipeline_status. i trying utilize count method in rails, , pass in conditions - whilst tells me how many sales_opportunities user has (in total), not take status argument , filter count depending on enum pass. can help or point me toward resource can help me larn right way utilize please? sales_opportunity.rb: class salesopportunity < activerecord::base default_scope { order('close_date asc') } belongs_to :user belongs_to :company has_many :timeline_events, dependent: :destroy has_many :swots, depe

android - How to create an rectangle area when capturing ( camera ) -

android - How to create an rectangle area when capturing ( camera ) - i accomplish this: so thing capture , process area in rectangle. need because want ocr , don't want whole screen. i solved 9patch picture. android

python - Can't get value of Entry Widget in Tkinter -

python - Can't get value of Entry Widget in Tkinter - i'm wanting retrieve value (a filename) of entry widget in tkinter gui , utilize in file_open function filename, read it, , homecoming contents text widget. but i'm getting attribute error saying application object has no attribute f3_entry (despite me creating entry widget assigned f3_entry). doing wrong here? from tkinter import * tkinter.filedialog import loadfiledialog, savefiledialog, directory class application(frame): def __init__(self, master=none): frame.__init__(self, master) self.grid() self.master.title("grid layout") self.createwidgets() def createwidgets(self): def handler(event): print("frame {} clicked @ {} {}".format(event.widget, event.x, event.y)) r in range(6): self.master.rowconfigure(r, weight=1) c in range(6): self.master.columnconfigure(c, weight=1) f

php - Create dynamic tests with PHPUnit -

php - Create dynamic tests with PHPUnit - i trying write dynamic tests in php. the thought parts of code test (based on annotations). i have working 1 way; test class has single method testrun , dataprovider testrunprovider tests each method in turn given set of info dynamically generated. work, when test fails not readable, there 1 test different data. i've tried numerous combinations of creating tests , suites within test has provider, feeds methods, far can figure should mean each method test, create new suite of tests it, pass info too. the closest ive gotten name of "new" test show, never completes , test runner doesnt recognise new test in total count. so turns out there - can define custom test suite putting static function called suite takes argument name of suite. where going wrong not returning suite creates. php unit-testing dynamic

opengl - Will the fragment shader automatically clamp the color value to its range? -

opengl - Will the fragment shader automatically clamp the color value to its range? - will fragment shader automatically clamp color value range? do need explicitly clam value int shader code? if not, , shader automatically clampping, mean save processing time? yes, clamped automatically if color buffer in normalized fixed-point format. copied opengl 3.3 spec: color values written fragment shader may floating-point, signed integer, or unsigned integer. if color buffer has signed or unsigned normalized fixed-point format, color values assumed floating-point , converted fixed-point described in equations 2.6 or 2.4, respectively; otherwise no type conversion applied. the referenced section "conversion floating-point normalized fixed-point" says (emphasis added): the conversion floating-point value f corresponding unsigned normalized fixed-point value c defined first clamping f range [0, 1], ... explicitly clamping in fragment shader waste of operat

java - Log4j 2: How to Use XMLLayout? -

java - Log4j 2: How to Use XMLLayout? - the log4j 2 manual states: an appender uses layout format logevent form meets needs of whatever consuming log event. among several of appenders in log4j2.xjm, have this: <rollingfile name="rollingratefile" filename="${sys:webapp.rollinglogspath}/${sys:webapp.name}.rate.log" filepattern="${sys:webapp.rollinglogspath}/${sys:webapp.name}.log-%d{yyyy-mm-dd}-%i.rate.log"> <patternlayout> <pattern>%d{yyyy-mm-dd hh:mm:ss.sss} %m%n</pattern> </patternlayout> <policies> <sizebasedtriggeringpolicy size="10 mb" /> </policies> <defaultrolloverstrategy min="1" max="4" /> <xmllayout complete="true" charset="utf-8" compact="false"/> </rollingfile> when tomcat starts, error: 2014-11-06 12:45:40,631 error ap

Python ValueError: No JSON object could be decoded -

Python ValueError: No JSON object could be decoded - i'm trying read json , values. have folder json's archives, , need open archives , values them. this code: # -*- encoding: utf-8 -*- pprint import pprint import json import os def start(): dirname, dirnames, filenames in os.walk('test'): filename in filenames: json_file = open(os.path.join(dirname, filename)).read() # json_file = unicode(json_file, 'utf-8') json_data = json.loads(json_file) pprint(json_data) key, value in json_data.items(): print "key : ", key print "value: ", value start() this 1 of json's { "test" : "search user 1", "url" : "http://127.0.0.1:8000/api/v1/user/1/?format=json", "status_code" : 200, "method" : "get" } but when run it, this: valueerror: n

c++ - How to get the files that not appear in the QTreeView -

c++ - How to get the files that not appear in the QTreeView - i'm utilize qtreeview setfilter() function allow display directories , drivers files not allowed. but want files don't appear in qtreeview , go on display directories , drivers without files in qtreeview . qfilesystemmodel dirsmodel = new qfilesystemmodel; dirsmodel->setrootpath(""); ui->treeview->setmodel(dirsmodel); dirsmodel->setfilter(qdir::alldirs | qdir::nodotanddotdot); how can ? as said before need entrylist . example: void mainwindow::on_pushbutton_clicked() { qmodelindex ind = ui->treeview->currentindex(); qfilesystemmodel *sys = qobject_cast<qfilesystemmodel*>( ui->treeview->model()); qstring path = sys->filepath(ind); qdebug() << path; qdir dir(path); qstringlist files = dir.entrylist(qstringlist(), qdir::files); if(!files.size()) qdebug()<< "empty"; else for(int i

xcode - is it sufficient to supply 3x image only for all versions on iPhone? -

xcode - is it sufficient to supply 3x image only for all versions on iPhone? - is not plenty supply 3x resolution image (e.g view or button) in xcode looks on iphone 5,6,and 6plus devices ( i.e leaving 1x , 2x in image set blank ) my reasoning 1x image may blurry on 6 plus 3x image should fine on 5 basically asking can communicate same graphic designer , should fine supplying singe size rather 3 sizes images this got asked , answered many times regarding 2x assets, , reply hasn't changed (but it's hard track downwards duplicate questions when i'm posting phone). if ship assets higher scale factor target device, display fine. downscaling them in real time has performance costs—they utilize more memory, take longer upload gpu, take gpu time render. of these costs trivial, others aren't. (remember, 2x image 4x info of 1x one, , 3x image 2.25x info of 2x one.) , add together every image in app. most importantly, devices lower scale factors on

coffeescript - JSON will not insert into Meteor Collection (even with Fiber or bindEnvironment) -

coffeescript - JSON will not insert into Meteor Collection (even with Fiber or bindEnvironment) - i realize similar topics have been discussed, have browsed through them , tried mimic solutions 4 hours none of them seem solve problem. not have posted having exhausted potential solution find. i trying convert big csv json , insert meteor collection next conversion. here code using meteor.bindelement approach: if meteor.isserver @fiber = meteor.npmrequire("fibers") meteor.startup -> #converter class if data.find().count() 0 converter = meteor.npmrequire('csvtojson').core.converter fs = meteor.npmrequire('fs') csvfilename = '/path/to/my/file.csv' filestream = fs.createreadstream(csvfilename) #new converter instance csvconverter = new converter(constructresult: true) #end_parsed emitted 1 time parsing finished csv

solaris - Unexpected end of line seen: Makefile -

solaris - Unexpected end of line seen: Makefile - have setup.mk file following: cc = gcc cflags += -g -o2 -c -wall -pthreads ver = 64 ifneq (32, $(ver)) <tab>cc += -m64 # line 26 endif processor = big ifeq (little, $(processor)) <tab>cflags += -dlittle_endian endif when create through command line, works fine. when create through deployment tool (vulcan), however, next error: "make: fatal error in reader: /[path]/setup.mk, line 26: unexpected end of line seen" note following: >echo $path >/usr/gnu/bin:/usr/sbin:/usr/bin >which create >/usr/gnu/bin/make logged in same user when deploying through vulcan (using sshexec run start_make.sh script). thanks help in advance! makefile solaris gnu-make

javascript - character selction option for the players in tic-tac-toe -

javascript - character selction option for the players in tic-tac-toe - i have made tic-tac-toe game.for have create character selection module each player.players have take between x , o.if first 1 selects 'o' ,other player can not select that.he has take 'x'.but including html lines ,the code have written 50 lines , fragile, can't find other way shorten code.selection alternative basic thing in games.any expert solution on matter appreciated class="snippet-code-js lang-js prettyprint-override"> function player(name,val){ this.name=name; this.val=val; } var ps=document.getelementbyid('ps'); ps.addeventlistener('click',function(e){ player1=prompt('input player1'); char1=prompt('input char between x/o'); if((char1 != 'x') && (char1 != 'o')){ for(;;){ alert('select between x o please'); char1=pro