Posts

Showing posts from June, 2012

php - Cannot save POST items to database with Phalcon framework -

php - Cannot save POST items to database with Phalcon framework - controller: class peoplecontroller extends \phalcon\mvc\controller{ public function indexaction(){ } public function createpersonaction(){ $person = new people(); $person->firstname=$this->request->getpost("firstname"); $person->surname=$this->request->getpost("surname"); $person->telephone=$this->request->getpost("telephone"); $person->email=$this->request->getpost("email"); $person->city=$this->request->getpost("city"); $person->country=$this->request->getpost("country"); $person->save(); if ($person) { echo"successfully registered user!"; } else { echo "sorry, next problems generated: "; foreach ($person->getmessages() $message) { echo $message-&

javascript - bootstrap3 - hide.bs.dropdown function firing regardless of .click definition? ..with fiddle -

javascript - bootstrap3 - hide.bs.dropdown function firing regardless of .click definition? ..with fiddle - have setup .click event calls setread() function when dropdown-menu closes, triggers ajax call. right now, reason setread() function beingness called regardless of .click definition.. http://jsfiddle.net/n2v9s/6/ setread() should called when .markread clicked, not .markedread here's html (it involves handlebars templating, value different id each btn): <div class="thisness"> <div class="exterior"> <input type="hidden" name="storyid" id="storyid" class="storyid" value="id1" /> <div class="interior"> <div class="btn-group dropdown markread"> <button type="button" class="btn dropdown-toggle" data-toggle="dropdown"> <span class="glyphicon glyphicon-unchecked&qu

Qt Quick 2 vs HTML5 for desktop touch application -

Qt Quick 2 vs HTML5 for desktop touch application - we startup based in republic of india application built on qt quick, deployed in hd touch devices in retail stores. application runs more web-app rather desktop app. have serious hiring problems , fear of future while using qt quick. hence need know if go ahead same or shift more adopted stack html, css , js. the info served using locally deployed web server(syncs cloud time time) serves info using recommendation , search engine. utilize qt quick both getting info using ajax , ui made using qml's elements, touch events, animations, state - transitions. left basic operations in c++ read configuration files, etc. we had developed prototype 2 years ago in html5 using sencha , not happy performance , touch behaviour, hence picked qt. because much harder develop 'beautiful' looking apps in fast development cycle on qt, stylesheet'ing extremely naive on qt, want reconsider if move qt html5 or think of framew

python - How can I determine if a test passed or failed by examining the Item object passed to the pytest_runtest_teardown? -

python - How can I determine if a test passed or failed by examining the Item object passed to the pytest_runtest_teardown? - pytest allows hook teardown phase each test implementing function called pytest_runtest_teardown in plugin: def pytest_runtest_teardown(item, nextitem): pass is there attribute or method on item can utilize determine whether test finished running passed or failed? couldn't find documentation pytest.item , hunting through source code , playing around in ipdb didn't reveal obvious. python py.test

OpenCV VideoCapture C++: reading 2 frames gives the same picture -

OpenCV VideoCapture C++: reading 2 frames gives the same picture - i writing programme loop captures 2 different frames in each iteration of loop. webcam directed @ changing. the 1st , sec frame within single iteration of loop different each other, expected. however, many times (but not of time), 2nd frame of i'th iteration of loop looks exact same 1st frame of (i+1)th iteration of loop. why happen? here code... #include "opencv2/core/core.hpp" #include "opencv2/features2d/features2d.hpp" #include "opencv2/nonfree/features2d.hpp" #include "opencv2/calib3d/calib3d.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/nonfree/nonfree.hpp" #include "opencv2/imgproc/imgproc.hpp" #include <iostream> #include <fstream> #include <sstream> #include <stdlib.h> using namespace cv; using namespace std; int main(int argc, const char *argv[]) { //open webcam ca

python - my while loop gets called instead of my function -

python - my while loop gets called instead of my function - so when seek phone call customer_name() function keeps calling while loops first. seems phone call phone_number while loop goes onto customer_name loop. if take phone_number while loop away calls while loop pizza_menu. i've tried prepare several times no luck, help me? tried add together variables customer_name, phone_number etc print out @ end keeps giving me "not defined" wanted add together them list print hem out @ end. wish can help me , appreciate that. not allowed have classes , such because haven't learned yet. using python 3.3 premium_pizzas = ["supreme cheese", "the legendary pizza", "pentakill supreme", "teeto shroomo supreme", "the volcanic rengar", "cheese , ham" , "vegetriano" ] gourmet_pizzas = ["flame gorilla", "snazzy chicken", "intergalactic bbq", "bbq chicken", "

verilog - ModelSim simulation - modules not definied -

verilog - ModelSim simulation - modules not definied - i tried simulate verilog project (which uses lpm modules) in modelsim, in spite of adding needed libraries still had error saying modules not defined. know what's wrong? are telling modelsim search libraries modules during elaboration? illustration should pass next arguments vsim: vsim -l lpm_ver ... often pre-compiled verilog libraries suffixed "_ver" create sure referencing right library. simulation verilog modelsim

oracle - adding CustomerSalesTeam in customer in netsuite PHPToolkit -

oracle - adding CustomerSalesTeam in customer in netsuite PHPToolkit - when seek add together customersalesteam in client in netsuite via php code. gives me error fatal error: uncaught soapfault exception: [soapenv:server.userexception] org.xml.sax.saxexception: salesteam on {urn:relationships_2013_1.lists.webservices.netsuite.com}customersalesteamlist must of type {urn:relationships_2013_1.lists.webservices.netsuite.com}customersalesteam in c:\wamp\www\ns\phptoolkit\nsphpclient.php:287 stack trace: #0 c:\wamp\www\ns\phptoolkit\nsphpclient.php(287): soapclient->__soapcall('add', array, null, array) #1 c:\wamp\www\ns\phptoolkit\netsuiteservice.php(118604): nsphpclient->makesoapcall('add', object(addrequest)) #2 c:\wamp\www\ns\samples\add_customer.php(38): netsuiteservice->add(object(addrequest)) #3 {main} thrown in c:\wamp\www\ns\phptoolkit\nsphpclient.php on line 287 and client adding code : require_once '../phptoolkit/netsuiteservice.php

How to solve an overdetermined set of equations using non-linear lest squares in Matlab -

How to solve an overdetermined set of equations using non-linear lest squares in Matlab - a11 = cos(x)*cos(y) (1) a12 = cos(x)*sin(y) (2) a13 = -sin(y) (3) a21 = sin(z)*sin(x)*cos(y) - cos(z)*sin(y) (4) a22 = sin(z)*sin(y)*sin(x) + cos(z)*cos(y) (5) a23 = cos(x)*sin(z) (6) a31 = cos(z)*sin(x)*cos(z) + sin(z)*sin(x) (7) a32 = cos(z)*sin(x)*sin(y) - sin(z)*cos(y) (8) a33 = cos(x)*cos(z) (9) i have set of 9 equations , 3 unknowns. unknowns x, y , z. know values of a11, a12, a13 ....... a33. these values might have noise , hence have utilize optimization algorithm find best fit values of x,y, , z. how solve above set of overdetermined equations in matlab? i have been searching online , came across few functions notably one . but i'm confused what's best way approach problem. little direction needed.... my favorit

ruby on rails - What action should I use for create_or_update operation -

ruby on rails - What action should I use for create_or_update operation - rails has basic rest operation create/update/show/destroy, if want action create or update existing record should create custom action ? i know rails has first_or_initialize , doesn't seem fit definition of create or update. in understanding create should create new record , not update existing 1 , update should update without create new one. here example: i have model blog , tag , , bring together table blog_tags reference blog_id , tag_id , , user_id record suggest tag blog post. [blog]>-[blog_tag]-<[tag] | [user] my thought i'm thinking of new action put create_or_update illustration , route , have routes blog/[blog_id]/tag/[tag_id_to_add]/create_or_update . don't know right way or not. putting in create or update makes no difference. take update since method calling update. create sure it's documented action can create , upd

sql - ALTER table in vertica -

sql - ALTER table in vertica - i have table in vertica has time_stamp:int value unix timestamp, want alter info type int timestamptz ; i tried alter table exploded_names alter column time_stamp set info type timestamptz; but got next error rollback 2353: cannot alter type of column "time_stamp" since referenced in segmentation look of projection "exploded_names_b0" then tried drop projection : drop projection exploded_names_b0 cascade; rollback 4122: no up-to-date super projection left on anchor table of projection exploded_names_b0 hint: utilize drop table ... cascade drop anchor table , lastly projection, or create replacement super projection instead i don't want drop table. the error received telling column used in segmentation look projection , can't changed. restriction set info type option. can either create new superprojections , omit column in segmentation clause, or create new table , projections ne

java - Memory error when running unit tests in SonarQube -- forked VM terminated without saying properly goodbye -

java - Memory error when running unit tests in SonarQube -- forked VM terminated without saying properly goodbye - we consistently getting out of memory errors when running our sonar analysis. intermittent across machines, seems 1 time it, persists. [error] failed execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-cli) on project optimus-client-web-configuration: execution default-cli of goal org.apache.maven.plugins: maven-surefire-plugin:2.16:test failed: forked vm terminated without saying goodbye. vm crash or system.exit called ? [error] command wascmd.exe /x /c ""c:\program files\java\jdk1.7.0_45\jre\bin\java" -javaagent:c:\users\cxxx\appdata\local\temp\jacocoagent8301608889470684052.jar=destfile=target/jacoco.exec,excludes= *_javassist_* -jar c:\redesign_trunk\optimus-lms-server\optimus-client-web-configuration\target\surefire\surefirebooter2312966376869893038.jar c:\redesign_trunk\optimus-lms-server\optimus-client-web-co

c# - Calling a COM function with System.Type parameter from VBA -

c# - Calling a COM function with System.Type parameter from VBA - i developped api using c# .net in there's function "system.type" parameter : "public string myfunction(system.type mytype) { ... }" this function com visible. in excel workbook, reference api (myapi) , want phone call function don't find way so. possible ? public sub test() dim t string t = myapi.myfunction(???) end sub thank much. c# vba com system.type

performance - Character walks slow in my C# game -

performance - Character walks slow in my C# game - the issue i can't figure out why character moves slow when draw image. timers set 1 interval , never changed. help appreciated. here entire project: using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; namespace rice_boy_tester_2 { public partial class form1 : form { bool iggy = false; bool left2 = false; bool right2 = false; bool up2 = false; bool down2 = false; bool check2 = false; bool left = false; bool right = false; bool = false; bool downwards = false; bool check = false; public form1() { initializecomponent(); } private void form1_load(object sender, eventargs e) { // empty block } private void refresh_tick(object sender, eventargs e) { this.refresh(); }

Reading the syntax off of this listing at scala-lang -

Reading the syntax off of this listing at scala-lang - just learning basic stuff here. it appears count method vector useful me exercise i'm working on, reading entry @ scala-lang i'm having hard time understanding how utilize it, syntactically speaking. here's entry says: count(p: (a) => boolean): int i think that's supposed telling me syntax utilize when calling method. it tells me "p" predicate satisfied. okay, know predicate in abstact. predicate in scala though? then there's colon. type that? or meta-linguistic notation of kind? then there's rocket. okay. word boolean--but doing there? assume don't literally type "boolean." (do i?) anyway, see problem(s). how work? you there! count needs parameter p of type ( : ) a (rocket) boolean , 'a' type of elements stored vector. have provide function a boolean . so can utilize this: val v = vector(1, 2, 3, 4, 5, 6) // == vector[int](1,

create li according to a php array with javascript -

create li according to a php array with javascript - i database php array looks this: $dbresult= array([0]=>array([a]=>1 [b]=>1 [c]=>1) [1]=>array([a]=>2 [b]=>2 [c]=>2) [3]=>array([a]=>3 [b]=>3 [c]=>3) ) and in html ihave div id class . what create table phparray using javascript when label id="labletocreatetable" clicked, table should this a b c 1 1 1 2 2 2 3 3 3 i know should utilize json_encode when result looks , im not pretty sure how utilize it [{"a":"1","b":"1","c":"1"}, {"a":"2","b":"2","c":"2"}, {"a":"3","b":"3","c":"3"}] i not sure wanted might helps you <?php $dbresult= array(0=>array('a'=>1, 'b'=>1, 'c'=&g

c# - Weird "Object reference not set to an instance of an object" error while using Moq -

c# - Weird "Object reference not set to an instance of an object" error while using Moq - i trying run test "object reference not set instance of object". thoughts? using moq. test method: // arrange mock<icustomerrepository> customerrepo = new mock<icustomerrepository>(); client newcustomer = new customert() { id = 123456789, date = datetime.now }; customerrepo.setup(x => x.add()).returns(newcustomer); var controller = new customercontroller(customerrepo.object, new mock<iproductrepository>().object); // deed ihttpactionresult actionresult = controller.createcustomer(); createcustomer method: client newcustomer = customerrepository.add(); //error occurs below homecoming created(request.requesturi + "/" + newcustomer.id.tostring(), new { customerid = newcustomer.id }); when set moq, need additionally configure httpcontext, otherwise request null. c

Python windows extensions vcvarsall.bat incorrect windows SDK registry key -

Python windows extensions vcvarsall.bat incorrect windows SDK registry key - i having lot of problem trying build python extensions on particular machine. has both vs2008 , vs2013 installed along with, believe be, right c/c++ libraries, etc. comparing 2 machines have same software, , vcvarsall.bat , bin\amd64\vcvarsamd64.bat files identical. one difference i've noticed 2 machines have different values :getwindowssdkdirhelper bin\amd64\vcvarsamd64.bat : good: c:\program files\\microsoft sdks\windows\v6.0a\ "bad": c:\program files (x86)\microsoft sdks\windows\v8.1a\ what i've tried, based on the various environment variables set vcvarsall.bat: set lib=c:\program files\\microsoft sdks\windows\v6.0a\lib\x64 . removes 1 error still error link2019: unresolved external symbol __imp_queryperformancecounter plus 6 similar errors. i've tried setting include , lib , libpath , still link2019 errors. so, have couple questions: can alter registry

javascript - setInterval keeps giving me undefined function -

javascript - setInterval keeps giving me undefined function - this question has reply here: pass right “this” context settimeout callback? 5 answers i have function in code works slider elements within class. want setinterval on click event keeps giving me function undefined. here script: $(document).ready(function(){ $(".slide").click( setinterval( function fadenext() { $(this).children('div:nth(0)').children('img:nth(0)').fadeout().appendto($(this).children("div:nth(1)")); $(this).children("div:nth(1)").children('img:nth(0)').fadein().appendto($(this).children("div:nth(0)")); },1000) ); }); in setinterval functions this belongs anonymous function, not click one. need pass this in interval. solution utilize bind on anonymous function $(d

java - FileNotFoundException with Pig -

java - FileNotFoundException with Pig - i running shell script pig command pig -param_file some-filename getting next exception : filenotfoundexception . checked , file exists @ given location. cause problem ? error before pig launched error 2997: encountered ioexception. file some-file.properties not exist java.io.filenotfoundexception: file some-file.properties not exist @ org.apache.hadoop.fs.rawlocalfilesystem.getfilestatus(rawlocalfilesystem.java:520) @ org.apache.hadoop.fs.filterfilesystem.getfilestatus(filterfilesystem.java:398) @ org.apache.pig.impl.io.filelocalizer.fetchfilesinternal(filelocalizer.java:791) @ org.apache.pig.impl.io.filelocalizer.fetchfile(filelocalizer.java:735) @ org.apache.pig.main.fetchremoteparamfiles(main.java:756) @ org.apache.pig.main.run(main.java:408) @ org.apache.pig.main.main(main.java:157) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(na

jquery - .on("click") does not work on iOS -

jquery - .on("click") does not work on iOS - i noticed that $("body").on("click", "#id", function(event) {... does not work on ios while $("#id").on("click", function(event) {... works perfectly. same site, same jquery (latest), same dom. can't utilize latter because #id added dynamically. ideas? try follows once: $(document).on("click touchstart", "#id", function(event) {... jquery ios click

c# - How would i create an array of images and then load each image into successive indexes -

c# - How would i create an array of images and then load each image into successive indexes - as can see i've created array of images, i'm not sure how load each image successive indexes. someone told me game i'm not sure how or if prepare problem i've made game character walks left so downwards right , few timers load animation , handle motion when draw using code *e.graphics.drawimage(properties.resources.corn_cobs, 70, 70, 40, 40);* my character gets laggy/slow when don't draw image works smoothly , character speeds normal. here code: namespace rice_boy_tester_2 { public partial class form1 : form { bool iggy = false; bool left2 = false; bool right2 = false; bool up2 = false; bool down2 = false; bool check2 = false; bool left = false; bool right = false; bool = false; bool downwards = false; bool check = false; image[] animations; public form1() { initializecompon

What is the Grails application library? -

What is the Grails application library? - in book, definitive guide grails 2, see code fragment appear once: <g:javascript library="application"/> no explanation there tell application library and/or does. know? yes , know. <g:javascript library="application"/> no wonder ,and explain below. this line speaking of javascript file named application.js under /webapp/js/application.js . what ? let if have multiple javascript file utilize different page of application.not , have 30 other more javascript file depending on javascript file . then how load page? list them each file in each jsp file 1 1 ? sucks! , grails alleviated problem using resource plugin ...which defined under applicationresources.groovy defined follow : modules = { application { resource url:'js/application.js' resource url:'js/yourotherjavascript.js' resource url:'js/otherlibrary.js' } application2

c# - Character or text limit in ScrollView or TextBlock? -

c# - Character or text limit in ScrollView or TextBlock? - is there limit amount of data/text can stored in textblock/scrollviewer? i have this: <scrollviewer height="auto" margin="0,151,0,0"> <textblock x:name="audittext" text="textblock" verticalalignment="top" foreground="white" height="auto" margin="0,10,0,0" grid.row="1" padding="20" textwrapping="wrap"> </textblock> </scrollviewer> it appears work farther downwards scroll find this: as can see there more text stops....any ideas? the reason issue element must displayed beyond area larger 2048x2048 pixels clipped platform. you need split text segments blocks , display. textblock cutting text in windows phone c# windows-phone-8 text scrollviewer textblock

html - aligning divs using float and z-index -

html - aligning divs using float and z-index - i can't believe can't working! this i'm going can't @ all! +------------------------------------------+ | div 1 | | +-------------+ | | | div 2 | | +-------------| |--------------+ +-------------| |--------------+ | div 3 | | div 4 | | +-------------+ | | | +-----------------+ | |+-------------------------+ | || div 5 | | || | | || | +---------------++-------------------------+ i have tried placing divs in every different order possible. i have container whole page set position: relative #div1 { width: 950px; } #div2 { position: absolute; height: 150px; width: 150px; margin: -100px au

windows - Controlling Firefox from C++ -

windows - Controlling Firefox from C++ - i running mozilla firefox on windows 7 , able send simple commands (new tab, minimize, close tab) c++ program. the usual question of inter-process communication, when both processes part of same user program, seems answered boost.interprocess. but controlling gui window of exclusively independent application (mozilla)? you can utilize spy++ debug messages each action produce, replicate messages in program. c++ windows interprocess

qt creator - QtCreator CMake editor indenting -

qt creator - QtCreator CMake editor indenting - i have qt creator 3.1.1 setup indent 4 spaces on tab , reason tab key doesn't work when edit cmakelists.txt . happens when open cmake editor , works when utilize plain text editor . bug or need configure somehow create tab key work? i had same problem. issue occured because have enabled auto-indent. value in "preferences->text editor->behavior" tab "typing->tab key performs auto-indent" set else "never". so prepare issue you need set "tab key performs auto-indent" "never". cmake qt-creator indentation

java - how to call the class again if the user enter wrong input using keyboard -

java - how to call the class again if the user enter wrong input using keyboard - package simple; import java.io.bufferedreader; import java.io.inputstreamreader; class areaofcircle{ public static void main(string args[]){ float pi = 3.1416f; int r=0; string rad; bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); system.out.println("radius?"); try{ rad = br.readline(); r = integer.parseint(rad); system.out.println("circle area is: " + pi*r*r + " permieter: " +pi*2*r); } catch(exception e){ system.out.println("write integer number"); areaofcircle = new areaofcircle(); } } } here in code , assume user come in string using keyboard, @ point in seek block shows exception , comes grab block, and want show details of error , want forc

javascript - Using JSON to generate HTML elements, multiple class names and id. - Without JQuery -

javascript - Using JSON to generate HTML elements, multiple class names and id. - Without JQuery - i've been building virtual rubik's cube on codepen using js , css only. - forgive me apparent stupidity, have been coding less 3 months, , less 1 month in js. i have made 2 versions, version 3 need generate much of html possible using json , js loop structures. despite doing tonnes of reading on json, can't quite head around concept of using generate html have been standard js arrays. see codepen link-- http://codepen.io/peachey_a/pen/hecdh whilst have used little bit of jquery add together class attributes in version 2; steer clear of in generation process goal understand js before getting involved libraries. any advice of specific websites or code snippet examples appreciated. thanks as far manipulating json recommend using library (if browser doesn't back upwards natively), if trying away jquery should take @ http://youmightnotneedjquery.com/

c# - noda time iana mapping of Etc/UTC to Windows timezone -

c# - noda time iana mapping of Etc/UTC to Windows timezone - i have global website passing iana timezone id server , using noda time map windows timezone in c# 5 web app. "etc/utc" beingness passed server noda time can not map windows time zone. how can map iana timezone id? public timezoneinfo gettimezonebyianaid(string ianatimezoneid) { tzdbdatetimezonesource timezonesource = tzdbdatetimezonesource.default; ilist<mapzone> zonemaps = timezonesource.windowsmapping.mapzones; // resolve link, since cldr doesn't utilize canonical ids ilist<string> mapzoneids = timezonesource.canonicalidmap.where(map => map.value.equals(ianatimezoneid, stringcomparison.ordinalignorecase)).select(x => x.key).tolist(); mapzone mapzone = zonemaps.firstordefault(zonemap => zonemap.tzdbids.any(mapzoneids.contains)); if (mapzone == null) { throw new timezonenotfoundexception("unable determine clients timezone using jstimezo

java - How to check list.contains in jsp using struts 2 tags -

java - How to check list.contains in jsp using struts 2 tags - i need show series of check boxes , if status succeeded, need check them. below code. have regions hashmap , selectedregions array list. iterating on regions map, , displaying checkboxes text next value regions map. now, while iterating, if value of regions map available in array list, need create check box checked. else united nations checked. tried 1 shown below. not working. class="lang-xml prettyprint-override"> <s:iterator value="regions"> <li> <div class="listclass"> <s:if test="#regions.value==selectedregions.value"> <input type="checkbox" id='mytheater' checked="checked" name="theatercheckbox" class="theatercheckbox" /> <s:property value="value" /> </s:if> <s:else>

ios - How to work on XCode project with more than 1 developer -

ios - How to work on XCode project with more than 1 developer - i've been working solo on xcode projects while now, , in new project need work several developer. how go that? i've been using dropbox while , know source command (git, locally) i'm using own tracking. how branch out , allow other developers work on that? open same project on dropbox (syncing issues?)? , how merge them again? you utilize service github help this: https://github.com/ also, bitbucket similar service has added benefit of free private repos. there's no need resort dropbox. both , other developer can work on separate branches , merge code master branch needed. ios xcode git

javascript - window.history.pushState refreshing the browser -

javascript - window.history.pushState refreshing the browser - i working on javascript code, , using window.history.pushstate load new html pages, instead of using href tags. code (which working fine) looks this. window.history.pushstate({urlpath:'/page1'},"",'/page1') strangely, fails, ie reloads browser window.history.pushstate({urlpath:'/page2.php'},"",'/page2.php') but works, content updated, browser not refreshed ! (notice url absolute , not relative) window.history.pushstate({urlpath:'www.domain.com/page2.php'},"",'www.domain.com/page2.php') the documentation window.history.pushstate says 3rd parameter url can either absolute or relative - url — new history entry's url given parameter. note browser won't effort load url after phone call pushstate(), might effort load url later, instance after user restarts browser. new url not need absolute; if it

Finding placeholders and put then in an array with jQuery -

Finding placeholders and put then in an array with jQuery - i have next text. my name ++name++. age ++age++. name of city ++city++ , on. so want find out instances wrap withing ++ , force them array jquery. try this: "my name ++name++. age ++age++. name of city ++city++ , on." .match(/\+\+.*?\+\+/g) .map(function(s){ homecoming s.slice(2, -2); }) jquery

c# - LINQ distinct is showing duplicates -

c# - LINQ distinct is showing duplicates - i trying utilize linq find duplicates. have read, should utilize distinct . query below finds duplicates in list, contains both original value , duplicate. how can distinct items? class macroconfig { public guid? guid { get; set; } public string name { get; set; } public string value { get; set; } } //this linq query using list<macroconfig> dupelist = macrolistwithduplicates.groupby(x => x.guid) .where(y => y.count() > 1) .selectmany(y => y) .distinct() .tolist(); foreach (var x in dupelist) { console.writeline(x.tostring()); } distinct() homecoming distinct macroconfig objects, because macroconfig's distinct() receiving input. if want 1 item each guid, can select first item each group: list<macroconfig> dupelist = macrolistwithduplicates .groupby(x => x.guid) .where(grp => grp.count() > 1) .select(grp => grp.first()) .tolist(); c# linq li

mobile - Resolution of smartphone browsers -

mobile - Resolution of smartphone browsers - i'm curious how android phones calculate resolution of responsive web pages. example, know while iphone 5s has native resolution of 640x1136, resolution uses webpages 320x568. (so can measure elements of design accordingly when needed - typically utilize percentages, need measure elements in pixels) so, when android phone visits responsively designed website, , has native resolution of 1920x1080, elements on web page beingness rendered in terms of size? 1/2? or different between devices? the testing i've done isn't giving me clear thought of what's happening. thanks! in experience, of time can results want if construction correctly , focus on device width. device width true measure of pixels on smartphone or tablet, figures resolution typically double retina devices. structuring correctly means: (1) in head of doc include meta tag <meta name="viewport" content="width=device-w

Differ b/w type=submit & type=button in javascript? -

Differ b/w type=submit & type=button in javascript? - *i'm trying apply error class email label. when press button, type=submit. error class apply , page 1 time again refresh imidiately & error class doesn't apply. when same @ type=button, error class apply correctly email label..! * <script> function check() { var email = document.getelementbyid("email"); var password = document.getelementbyid("password"); if(email.value=='') { alert("email"); email.classname = 'error'; } else { alert("not"); } } </script> <form> <table width="264" border="0"> <tr> <td width="84"><label for="email">email: </label></td> <td width="164"><input type="email" name="email" id="email" /></td> </tr>

CakePHP - Iterate through variable passed from Controller to View by using plain query -

CakePHP - Iterate through variable passed from Controller to View by using plain query - i passing next variable tagscount controller view: $this->set('tagscounts', $this->tag->query(' ( select t.id, t.sk_name, 0 count tags t t.id not in ( select tag_id video_tags vt ) ) union ( select t.id, t.sk_name, count( * ) count videos v bring together video_tags vt on ( v.id = vt.video_id ) bring together tags t on ( t.id = vt.tag_id ) grouping t.id order count( * ) asc )' )); and in view want iterate trough variable. using code: <?php for($z = 0; $z < sizeof($tagscounts); $z++): ?> <?php echo $tags[$z]['tag']['count'];?> <br> <?php endfor; ?>

web scraping - python : Website Data to txt or xls -

web scraping - python : Website Data to txt or xls - i not in python, trying info website , info in tables, want info in txt / xls, i made script when script go website, work until entry come whihc have no data. webiste : bizearch.com in entry python script stop: www.bizearch.com/company/russell_metal_products_inc_125558.htm i using centos, python, beautifulsoup. my script : #/usr/bin/env python # bs4 import beautifulsoup import urllib getinfo = ['company name', 'contact person', 'company address', 'postal code', 'telephone number', 'mobile number', 'fax number', 'website', 'business type', 'business role'] flushdata = {} print "company name|contact person|company address|postal code|telephone number|mobile number|fax number|website|business type|business role" page in range(1,900): pagedata = urllib.urlopen("http://www.bizearch.com/company/electrical_equipment~

Setting apache server wide variables with python -

Setting apache server wide variables with python - i able phone call python script checks see if variables passed have been passed , if not spit out kml file google earth read. i've looked @ environment variables no avail. need store string next time script called can reference it. i'll post have below. , help appreciated. edit: suppose didn't state issue, i'm attempting phone call python script on apache server kml passing url variables script. 1 of url variables contains time string, store time , able reference next "time" passed script, if times don't match print out kml, if match print empty script google earth doesn't duplicate placemark. in essence filtering kml files can avoid duplicates. i've updated code below. import cgi import os url = cgi.fieldstorage() bbox = url['test'].value bbox = bbox.split(',') lat = float(bbox[0]) lon = float(bbox[1]) alt = float(bbox[2]) when = str(bbox[3]) if when == os.environ

javascript - Search functionality in php cms -

javascript - Search functionality in php cms - i'm using phozo gallery & blog, have setup many pages within it, , realised there no plugin/page-script available accomplish internal search. there plugin/scripts already? still under development? can utilize production? i have huge info here in this, cant move manually other cms, please help me if 1 used already. here urls cms page its there in phozo, has basic capabilities , can utilize production, please check documentation here. javascript php html css search

Java how to create a custom Exception to limit the size of a HashMap -

Java how to create a custom Exception to limit the size of a HashMap - i have method inserts new items hashmap , want limit size of hashmap throw exception when size of hashmap larger specific value, 100 , below implementation: public void addtohashmap(string id, object value) throws hashmapoutofboundexception{ hashmap.put(id,value); } private class hashmapoutofboundexception extends exception{ //what should within class? } why not simple: public void addtohashmap(string id, object value) { if (hashmap.size()+1 > max_size) throw new hashmapoutofboundexception(); hashmap.put(id,value); } with public class hashmapoutofboundexception extends runtimeexception {} from javadoc: runtimeexception , subclasses unchecked exceptions. unchecked exceptions not need declared in method or constructor's throws clause if can thrown execution of method or constructor , propagate outside method or constructor boundary.

How to print month name from MySQL timestamp count in PHP? -

How to print month name from MySQL timestamp count in PHP? - i count article view timestamp month using json output. have code : $value = array(); $stats = access::fetch("select count(*) id news_stats grouping year(date), month(date)"); foreach($stats $key => $value){ $rows2[] = $value['id']; } echo json_encode($rows2); output : note: count month each month ["1","6"] i need print month name ouput this: ["january","june"] how can in print month name ? menaig is: 1 , 6 count month? try : $value = array(); $stats = access::fetch("select id, year(from_unixtime(date)) `year`, monthname(from_unixtime(date)) `month`, count(*) id news_stats grouping `year`, `month` order `year` desc, `month`"); foreach($stats $key => $value){ $rows2[] = $value['month']; } echo json_encode($rows2); output : ["june"

c# - Unity with repositories -

c# - Unity with repositories - i'm new unity ioc (di in general) , have read lot of documents , watched several hr long videos on channel 9. after of that, didn't find illustration demonstrated feature set in looking for. everything online showed can create repository, , register unity container. can inject repository view model constructors. in particular app, need back upwards parsecloud, box, dropbox , onedrive, along multiple implementations of interface. planned on creating 4 repositories, 1 each service. does create more sense have unity register single abstract repository factory, view models can utilize fetch right repository based on app configured for? another thing app (a task app) supports multiple implementations of itask, have basictask, gtdtask, googletask. thinking need repository method handle each implementation, , store implementation in right cloud service. how accomplish abstraction unity? best register of itask types , have abstract rep

objective c - Don't repeat yourself while writing unit tests -

objective c - Don't repeat yourself while writing unit tests - i have multiple singletons in app test this. spschemeparser* (^createuniqueinstance) (void) = ^spschemeparser* (void) { homecoming [[spschemeparser alloc] init]; }; spschemeparser* (^getsharedmanager) (void) = ^spschemeparser* (void) { homecoming [spschemeparser sharedmanager]; }; // test singleton it(@"can create unique instance", ^{ expect(createuniqueinstance()).tonot.benil(); }); it(@"can create shared instance", ^{ expect(sut).tonot.benil(); }); it(@"returns same shared instance", ^{ expect(sut).to.equal(getsharedmanager()); }); it(@"returns different unique instance", ^{ expect(createuniqueinstance()).tonot.equal(createuniqueinstance()); }); it(@"returns unique instance different shared instance", ^{ expect(sut).tonot.equal(createuniqueinstance()); }); now, don't want have snippet copy-pasted in every unit test fi

How to access the hostname from a new Python module in Ansible -

How to access the hostname from a new Python module in Ansible - i planning implement new ansible module run via local connection , create remote api calls host. there way in access name of host/ip address module? create decision on api utilize based on that. i'm assuming doing like, say, operating on network appliance jump host. right i'm not seeing inventory_host in ansiable module base of operations class, in case is: ansible_connection: local tasks: - name: config net app myconfig: action=create_rule host={{inventory_host}} then create host parameter of module. then inventory file might like: [firewalls] host123 host456 host789 ansible ansible-playbook ansible-awx

angularjs - angular- data-ng-bind-html - how its work -

angularjs - angular- data-ng-bind-html - how its work - need help in understand data-ng-bind-html. safe do: <div data-ng-bind-html="pagehtml"></div> what happen if pagehtml come users , contein scripts or html code can alter page? if check here https://docs.angularjs.org/api/ng/directive/ngbindhtml $sanitaze, sanitazor runs through code , removes possible injections , unsafe content scripts or js executions, after i'd suggest: trust no one angularjs

angularjs - Creating an Angular API Service to provide access to all Web APIs -

angularjs - Creating an Angular API Service to provide access to all Web APIs - i want create angular service allow me access number of $resource s, each access given api. example, want of api calls generated single service using syntax like var info = api.products.query(function() { $scope.products = data.products; }); or var info = api.customers.get({id:123}, function() { $scope.customer = data; }); where products , customers angular $resource s reside within api service. trying this var app = angular.module('myapp', ['ngroute', 'ngsanitize', 'ngresource', 'api']); var apiservice = angular.module("api", ["ngresource", function ($resource) { this.products = $resource('/webapi/products/:type/:id', {id:'all'}, { systemupdate: { method: 'get' }, }); this.customers = $resource('

Android fragment transition animation with Zoom-out page transformer -

Android fragment transition animation with Zoom-out page transformer - i want animation fragment transition help appreciated. want animation old xml files. http://developer.android.com/training/animation/screen-slide.html#pagetransformer its simple. utilize setcustomanimation in fragment transaction. seek this: myfragtransaction.setcustomanimations(android.r.anim.slide_in_left, android.r.anim.slide_out_right); where android.r.anim refers scheme defined animation resources. can utilize own implementation. android animation

mysql - Difference between database, table, column collation -

mysql - Difference between database, table, column collation - i understand collations set of rules making comparisons on character set. mysql has table , database collations in add-on column collation. wondering difference between collation on these 3 (database, table , column). thanks alot. mysql's character sets , collations can interpreted top-down list of prioritized items. topmost to the lowest degree priority , bottommost priority. order of precedence topmost beingness to the lowest degree precedence: server collation connection-specific collation database collation table collation column collation query collation (using cast or convert ) the server collation set server, set either within of my.cnf or when server built source code. default, latin1 or utf8 , depending on platform. the connection-specific collation set client using query set names 'utf8' collate 'utf8_unicode_ci'; . clients don't set connection-specific collat

java - Serializing ECJ GP Individual for later execution -

java - Serializing ECJ GP Individual for later execution - using genetic programming ecj 21, i'm looking suggestions on how serialize ec.individual (after successful(?) evolution). the trick is, need deserialize gp @ later stage, , execute it...preferably outside of ecj framework (there seems lot of scaffolding involved in "executing" gp while working in ecj framework, since aimed @ evolving thing, not "running" it). i have sorta there this: public static void main (string [] args) { file f = new file("./my.params"); if (!f.exists() ) { throw new invalidparameterexception(f.getname() + " not exist"); } parameterdatabase pd = new parameterdatabase(f, new string []{f.getcanonicalpath()}); output output = ec.evolve.buildoutput(); evolutionstate evs = ec.evolve.initialize(pd, 0,output); evs.run(evolutionstate.c_started_fresh); individual [] individuals = ((si