Posts

Showing posts from September, 2011

c++ - Incorrect serial port input/output -

i attempting activate serial port on beaglebone black , have connected tx rx. wrote test program. in it, setup serial port 1152000 baud , no parity according found @ how open, read, , write serial port in c . below main function: int main(void) { char *portname = "/dev/ttyo4"; int fd = open (portname, o_rdwr | o_noctty | o_sync); if (fd < 0) { printf ("error %d opening %s: %s", errno, portname, strerror (errno)); return 0; } set_interface_attribs (fd, baud_rate, 0); set_blocking (fd, 0); while (true) { write (fd, "hello!\n", 7); char buf [100]; int n = read (fd, buf, sizeof buf); std::cout << buf; std::cout.flush(); sleep(1); } return 0; } when run it, read on serial port rx, isn't hello, "รน¶" instead. can tell me why happening?? kind regards cornel

javascript - How can i alter the HEIGHT of PANEL in jquery mobile? -

how reduce height of panel in jquery mobile? $(function(){ $('#payable_panel').css('width','60%'); $('#payable_panel').css('height','30px'); } i've tried using code, doesn't seem work! in jqm panel min-height 100%. try following in style sheet. .ui-panel{ min-height: 200px !important; } here fiddle demo

java - Jenkins: Use Archived Artifact in Promoted Build -

i've archived artifact last step of build , it's available this: https://xxx.ci.cloudbees.com/job/xxx/52/artifact/target/xxx-1.2.1-snapshot-r8304-20130807-1507-app.zip how can access artifact in promotion process? please note need access specific build, not latest successful one. the goal of promotion process copy artifact s3 our deployment job further process it. might promote build #52 development (copy specific s3 bucket), later on promote build #50 production , on. ideally, can access artifact in shell script rename file etc. there environment variable access archived artifacts of build, cannot find or how should done? $build_url , $job_url specific promotion process , don't point build in shell scripts on promotion job. with copy artifact plugin can copy artifacts other builds in promotion process, don't need do. i believe have found solution. summary do not use specified permalink use specific build , set build number ${promoted_numbe...

meteor - Handlebar doesn't render a collection field correctly -

i'm having problem trying use collection field named created in template. reserved word, or something? the part of template that's struggling looks this: {{#each threads}} <tr> <td><a href="forumshowthread?id={{_id}}">{{topic}}</a></td> <td>{{creator.username}}</td> <!-- line below evil one. --> <td>{{created}}</td> <td>{{lastpost.poster.username}} {{datetime lastpost.posted}}</td> </tr> {{/each}} the threads find in console in browser following: [ object _id: "ngetonq8xm36ktg3s" created: 1375881336372 creator: function (){ creatorid: "zmkpmdhp4gtzqo98e" lastpost: function (){ posts: function (){ subcategory: function (){ subcategoryid: "axgd2xzctkfmphmwm" topic: "testing" __proto__: object , object _id: "xafemvavcrzpbkxg3" created: 1375882602652 creator: function (){ creatorid: ...

Including CoffeeScript file in rails -

i have taken @ coffeescript , want try out in rails app. know rails 3.1 coffeescript included within rails. having issues getting work. i have file called lens.js have renamed lens.js.coffee , , converted js coffee. screen casts have seen , blogs have read seemed needed. not picking file somehow. get http://www.cairo.dev/javascripts/lens.js 404 (not found) is console dropping. including other js files. = javascript_include_tag 'lens', 'jquery-ui.min', 'rails', 'application', 'popup', 'jquery.zclip', 'underscore-min' note: link haml which should work since compiles coffeescript js. wondered if wasn't installed added gem 'coffee-script' gemfile , bundled still nothing. am doing stupid. or missing? try not add gem 'coffee-script' in gemfile but: group :assets gem 'coffee-rails' end if doesn't work, can try removing lens javascript_include_tag , make sure have line...

Bootstrap textarea adding space characters inside text field -

i using bootstrap 3 rc1. problem having textarea — when page loads adds 3 spaces texarea, making placeholder text invisible, unless manually delete spaces. how stop happening? html <form id="notesubmitform"> <fieldset> <textarea id="note-text" rows="6" placeholder="add note" class="form-control"> </textarea> <div class="form group"> <button id="notesubmitbutton" type="submit" class="btn btn-success btn-custom"> save note </button> </div> </fieldset> </form> css textarea#note-text { width: 625px !important; } how stop happening? by not having whitespace between textarea tags, have right now: <textarea id="note-text" rows="6" placeholder="add note" …> </textarea> there’s line break (first line break directly @ beginni...

c# - Call Interface Method from Console Application -

i have web application have class: public class ptpostalcodeservice : iptpostalcodeservice { private readonly irepository<ptpostalcode> _ptpostalcoderepository; public ptpostalcodeservice(irepository<ptpostalcode> ptpostalcoderepository) { _ptpostalcoderepository = ptpostalcoderepository; } public ptpostalcodedto getptpostalcode(int postalcode, int? postalcodeextension) { ptpostalcode ptpostalcodedomain = new ptpostalcode(); ptpostalcodedomain = _ptpostalcoderepository.get( filter: p => p.postalcode == postalcode && (postalcodeextension.hasvalue == false || p.postalcodeextension == postalcodeextension), includeproperties: "ptcouncil, ptcouncil.ptdistrict").firstordefault(); var ptpostalcodedto = mapper.map<ptpostalcode, ptpostalcodedto>(ptpostalcodedomain); return ptpostalcodedto; } } now need access methid getptpostalcode consoleapplication, ide...

jsf 1.2 - JSF 1.2 hx selectone menu, on change update content without page refresh -

i have page selectonemenu , wondering if there way can update content in div without page refresh. trying right , doesnt work. know can onchange="submit()", refreshes page, dont want page refresh also, possible hx:behavior and/or ajaxrefreshsubmit? if yes can show me simple example achieve that. help <hx:selectonemenu value="#{bean.myvalue}" valuechangelistener="#{controller.valuechangemethod}"> <f:selectitems value="#{bean.values}" /> </hx:selectonemenu> <div id="divtobeupdated"> #{bean.displayvalue} </div> you use ajax above purpose. here sample code <h:form id="welcome"> <h:selectonemenu id="countrydropdown" value="#{pracbb.mycountry}" > <f:selectitem itemlabel="india" itemvalue="ind"/> <f:selectitem itemlabel="usa" itemvalue="usa"/> <a4j:support event="onchange" action...

node.js - nodejs request library, get the response time -

using nodejs request library: https://github.com/mikeal/request var request = require('request'); request('http://example.com', function (error, response, body) { ... }) is possible response time on callback? doc mentions response.statuscode. looking @ library source code see undocumented response.headers , response.href, don't see responsetime or similar. or, there alternative library request provides response time? ps: know this, that's not solution, making many async requests , cannot control when each request started. var request = require('request'); var start = new date(); request('http://example.com', function (error, response, body) { ... var responsetime = new date() - start; }) the request library can timing ( docs ): request.get({ url : 'http://example.com', time : true },function(err, response){ console.log('request time in ms', response.elapsedtime); }); as question implies,...

function - How do you get the values greater than a number from a list in scheme? -

how extract , return list numbers greater number found in given list? know how return max different. example (gfifty ‘(a b (c d) 1 56 67 g)) (56 67) in example above, returns list containing values greater 50. teach me master. :) the idiomatic solution use filter : (filter (lambda (x) (and (number? x) (> x 50))) '(a b (c d) 1 56 67 g)) => '(56 67) to see how write implementation scratch, take @ this answer. if search recursive (if must search inside sublists), study this other answer.

Find Type of Form Data -

so i'm not sure how word this. trying validate form data json schema. use dojo create form , fetch it's contents when user clicks submits. data in form returned strings. when schema finds field should number throws error because technically string if input '123'. there way form data while preserving it's primitive type? array.foreach(formdata, function(item) { postdata[string(item.title)] = domattr.get(item, "value"); }); any ideas? use parseint() or parsefloat() when validating string. check out here .

java - Access to one portlet from another -

i'm trying write portlet, in want create/edit .properties file inside other portlet (i want manipulate properties file responsible translates other portlet). want in following way: properties prop = new properties(); prop.setproperty("...", "..."); string pathtoohterportletpropertiesfile = ... prop.store(pathtoohterportletpropertiesfile); after run there following errors: severe: servlet.service() servlet seap servlet threw exception java.io.filenotfoundexception: (...my path...)\tomcat- 7.0.27\webapps (access denied) @ java.io.fileoutputstream.open(native method) @ java.io.fileoutputstream.<init>(unknown source) @ java.io.fileoutputstream.<init>(unknown source) @ main.translator.processaction(translator.java:49) does know solve problem? regards i suggest using portlet events solve instead. have first portlet send event portlet owns properties file. on event, pass along information other portlet need make update. have other ...

Connect local database c# -

Image
i want create empty local database inside project's folder , i've error: an unhandled exception of type 'system.data.sqlserverce.sqlceexception' occurred in system.data.sqlserverce.dll on line conn.open(); i'm lost need do. idea causing this? tried few solutions - 1 of them... sqlceconnection conn = null; try { conn = new sqlceconnection("data source = bd-avalia.sdf; password ='<asdasd>'"); conn.open(); sqlcecommand cmd = conn.createcommand(); cmd.commandtext = "create table cliente(id_cliente int identity not null primary key, nome varchar not null, password not null int)"; cmd.executenonquery(); } { conn.close(); } the error: if debug code (or output somehow) can check nativeerror property of sqlceexception , should tell cause of exception. see http://technet.microsoft.com/en-us/library/aa237948(v=sql.80).aspx explanation of code.

html - How to load an image using its real path in Grails -

my idea save images user uploads outside context path follow: d:\somefolder\myweb\web-app\ d:\somefolder\imagesoutsidecontextpath\ the code next (working locally): string path = servletcontext.getrealpath("/"); string parentfolder = new file(path).getparentfile().getparent(); string imagesfolder = parentfolder + "\\imagesoutsidecontextpath"; another idea (if 1 doesn't work on server) save images in current user's home folder @hoร nglong suggested me . but i'm not able load images view. think this article official documentation not valid purpose. the next code desn't load anything: <img src="d:\\somefolder\\imagesoutsidecontextpath\\bestimageever.jpg" alt="if don't see message, i'll happier"> how use real path instead url path load these images? you can set src action . user not know images stored (security) , can change logic display them. in action, image , print bytes. example here . ...

javascript - Are there any performance costs of using JSLINQ -

when read question, please not answer "memory cheap" or yada yada. i wondering; , save me time , i'd grateful, if had timed difference between raw approach querying javascript arrays including memory usage, versus using linq. an application building getting quite large on memory , yet tool jslinq beneficial me, able scientifically measure pros , cons of performance using jslinq rather brawl through javascript arrays myself save teenytiniest of performance. if there no responses, of course find out myself, nice little experiment future users. my javascript object arrays range generating tables of users = , orderby yada yada... doing joins on users profiles. trying find out if it's better return datasets , refine snippets of data javascript, or continuously call server side pages using ajax. regardless of choose, it's performance hit i'm interested in. jslinq looking tempting because uses familiar technique me, query data... alas, cannot use if add...

ASP.Net codebehind - get google paid advert info -

i have ecommerce site written in asp.net. there way site code see when user referred site paid google ad? note should work on page - not search landing page. [more detail - can see in google analytics 20%+ of paid click traffic hits 'register' page, small portion registers. want check how many of these failing captcha check, , hence bots rather real traffic.] you can implement solution using global application class (global.asax) file. if implement application_beginrequest event along request.server["http_referer"] or request.urlreferrer can know current request coming from, , capture possible google ads domains it. void application_beginrequest(object sender, eventargs e) { string referer = request.servervariables["http_referer"]; if (referer != null && referer.indexof("google") > -1) { //coming google } }

arrays - Python: Calculate metrics from list of APIs -

i have array of data looks this: #api name, min, max, average ['findproductbypartnumber', '336.0', '336.0', '336.0'] ['findproductbypartnumber', '336.0', '339.0', '337.5'] ['findproductbypartnumber', '336.0', '339.0', '338.0'] ['findproductbypartnumber', '336.0', '341.0', '338.75'] ['findproductbypartnumber', '336.0', '353.0', '341.6'] ['findproductbyid', '841.0', '841.0', '841.0'] ['findproductbypartnumber', '336.0', '920.0', '438.0'] ['findproductbypartnumber', '336.0', '944.0', '510.29'] ['findproductbypartnumber', '336.0', '952.0', '565.5'] ['findproductbypartnumber', '336.0', '975.0', '611.0'] ['findproductsbycategory', '113.0', '113.0',...

Audio Mixing in iOS using AVFoundation doesnt work -

i trying stitch bunch of videos , add music on video in ios. audio added using avmutableaudiomix . when video exported audio mix missing. here how code looks : - (void)mergevideos:(nsarray *)videos{ avmutablecomposition *mixcomposition = [[avmutablecomposition alloc] init]; avmutablecompositiontrack *videotrack = [mixcomposition addmutabletrackwithmediatype:avmediatypevideo preferredtrackid:kcmpersistenttrackid_invalid]; avmutablecompositiontrack *audiotrack = [mixcomposition addmutabletrackwithmediatype:avmediatypeaudio preferredtrackid:kcmpersistenttrackid_invalid]; cmtime currenttime = kcmtimezero; (avasset *asset in videos) { // 2 - video track [videotrack inserttimerange:cmtimerangemake(kcmtimezero, asset.duration) oftrack:[[asset trackswithmediatype:avmediatypevideo] ob...

xcode - Workspace created by cocoapods is locked -

i'm using cocoapods project. ran pod install , installed correctly. when try open created xcworkspace xcode displaying error 'workspace file locked'. tried unlock it's not working. didn't include frameworks (security.framework, mobilecoreservices.framework etc.) in workspace. i had problem recently. don't know missing frameworks, if go project folder within terminal , modify permissions on project files, should able open project. had modify multiple files , folders able stop asking me if want unlock files. steps worked me: use terminal go folder contains xcworkspace file. type sudo chmod 777 nameofyourworkspacefile.xcworkspace (please don't literally use file name unless that's xcworkspace file called). should change permissions entire workspace, still have unlock problem pods project. from within same directory, can chmod on pods folder so: sudo chmod 777 pods after that, go pods folder typing "cd pods" , modify p...

How Javascript Parsing the syntax -

actually, statement like., (var = 0, ; < row; i++,) {} makes *.js not load in browser. in c/c++ easy find, syntax error. here took me 20 mins trace bug happened accidentally in cut/copy/paste. my question : facing issue., when , why issue occurs? how find easily. as comments on question say, use development add-ons in browsers. can speak firefox, there bunch of great tools available. for firefox, normal debug console useful of need debug , test, can validation on of content firefox displaying/running. for things out of debug consoles reach, use firebug. can need inspect, @ headers , responses of ajax requests. i know chrome has developer tools, , bet there great add-ons out there too. these tools make things go faster using alert('spot1') ... alert('spot2') debugging techniques. give line numbers syntax errors.

html - Content area height 100% taking the header into account -

i trying fill length of screen content area of 100% height ignores header makes area long. other solutions not work. i need able adjust growing content (with scroll bar on page not #mainview), , when there not enough content fill page, #mainview should fill screen (with no scrolling). http://jsfiddle.net/ssf8s/6/ css: html, body { height: 100%; margin: 0px; } #container{margin:20px;height:100%} #header { height: 80px; background: pink; } #mainview { height: 100%; background: red; box-sizing: border-box; border:solid 4px pink;border-top:none; } html: <div id="container"> <div id="header"> --header </div> <div id="mainview"> --main </div> </div> let header overlay main view, , pad top of main view avoid it: #header { height:80px; background:black; position: absolute; top: 0; left: 0; width: 100%; } #mainview { height:100%; background:red; padding-top:...

c# - Microsoft.Office.Interop.Excel.Application SaveAs() method does not preserve encoding -

i'm having issue saving excel files csv's , preserving encoding in c#. specifically, following takes excel file , saves csv file same name, passed loadcsvdata function, job insert data database in organized fashion. issue excel file contains fractional symbols not recognized in csv format, unless manually open each .xml , save csv (for reason works while microsoft.office.interop.excel.application method saveas() not): list<string[]> data = new list<string[]>(); string filename = (date.tostring("mm/dd/yyyy") + ".csv").replace("/",""); string excelfilename = (date.tostring("mm/dd/yyyy") + ".xml").replace("/",""); system.console.writeline("processing file: " + filename); system.console.readline(); // open excel , save csv. process data microsoft.office.interop.excel.application ap...

eclipse - Adding connector in Subversive -

i add connector testing in subversive. however, under preference > team > svn > svn connector, can't seem see how this. should re-install plugin , select more 1 connector? in eclipse, goto help--> install new software in,install window, enter below url in work text field http://community.polarion.com/projects/subversive/download/eclipse/2.0/update-site/ then in below box you'll list of connector, select , click next...

android - ath6kl: interface is not up for AP mode -

i have ar6003 chip on android 4.2.2 device. switched open source ath6kl driver, having issue getting access point running. actually, can, in weird way. i using: hostapd v2.0-devel-4.2.2 wpa_supplicant v2.0-devel-4.2.2 this how run hostapd service in init.rc: mkdir /data/misc/wifi/hostapd 0770 wifi wifi chmod 0660 /data/misc/wifi/hostapd.conf service hostapd /system/bin/hostapd -dd /data/misc/wifi/hostapd.conf class main socket hostapd_wlan0 dgram 660 root wifi user root group wifi oneshot disabled hostapd.conf file: interface=wlan0 driver=nl80211 ctrl_interface=/data/misc/wifi/hostapd ssid=androidap channel=6 ieee80211n=1 when enable wi-fi tethering option in android ui, checkbox checked, notification active tether no appearing , ap mode not working. android reports: https://gist.github.com/thewhisp/6176213 when ap mode in "semi-working" state, via adb shell manually start hostapd (with su permissions): hostapd -dd /data...

performance - Scrolling is not smooth in android Grid View -

in android application, loading images api's. after images loaded in grid view, scrolling not smooth. using asynchronous threads fetch images not block ui. any suggestions improve performance of scrolling. loading images in separate thread helps, there's important performance issue take care of here, , that's "view reusability", once you've set image in adapter, make sure reusing views provided in getview method of adapter, , not creating/inflating new layout(gridelement) every time method called, causes scrolling go slow once images have been loaded, there's several patterns available approach issue, should read viewholder, common , easy use pattern issue... hope helps... regards

php - trying to switch these staements from pdo to mysqli -

how can change following piece of code try { $dbh = new pdo('mysql:host=xxxxxx;dbname=xxxxxx', 'xxxxxx', 'xxxxxx'); } catch(pdoexception $e) { print "error!: " . $e->getmessage() . "<br/>"; die(); } and piece of code try { $paginate = new pagination($page, 'select * demo_table order id', $options); } catch(paginationexception $e) { echo $e; exit(); } from pdo mysqli correspond each other? i don't see difference database makes pagination code block, based off of you've provided. have done research on mysqli? straightforward. at rate, code replaces pdo code. pagination code block requires more details before can addressed. try { $dbh = new mysqli('host', 'username', 'password', 'database'); } catch(exception $e) { echo "error: " $e->getmessage(); }

opencl - How to use clCreateImage -

i trying create cl_mem using clcreateimage program keeps crashing. following book close possible it's been pretty bump road far. #include "stdafx.h" #include <iostream> #include <cl\cl.h> using namespace std; int _tmain(int argc, _tchar* argv[]) { cl_int status; cl_platform_id platform; status = clgetplatformids(1, &platform, null); cl_device_id device; clgetdeviceids(platform, cl_device_type_all, 1, &device, null); cl_context_properties props[3] = { cl_context_platform, (cl_context_properties) (platform), 0 }; cl_context context = clcreatecontext(props, 1, &device, null, null, &status); cl_image_desc desc; desc.image_type = cl_mem_object_image2d; desc.image_width = 100; desc.image_height = 100; desc.image_depth = 0; desc.image_array_size = 0; desc.image_row_pitch = 0; desc.image_slice_pitch = 0; desc.num_mip_levels = 0; desc.num_samples = 0; desc.buffer = null; ...

service - how to know User have entered wrong password or pattern? (android lock) -

this question has answer here: patterns unlock attempts broadcastreceiver in android 1 answer i want service if user enters wrong pattern , number of that. googled it, got nothing useful. it's impossible, because it's android system , inaccessible, , there saying it's possible , they're talking "password_failed attempts" or something. and think it's possible, because there app when enter wrong pattern, takes picture front camera. any appreciated. a device administrator can use <watch-login /> policy see this. receives action_password_succeeded or action_password_failed each time, , can use devicepolicymanager#getcurrentfailedpasswordattempts query it. see device administration .

android - Finding Current Location and navigate to it not working -

hi develop app find current location , navigate current location. running on real device getting error "unfortunately current location has stopped". why getting error when correct...???? how can overcome it.... regards main activtiy code package com.example.routetracker; import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.mapfragment; import com.google.android.gms.maps.model.bitmapdescriptorfactory; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.markeroptions; import android.location.location; import android.location.locationlistener; import android.location.locationmanager; import android.os.bundle; import android.annotation.suppresslint; import android.app.activity; import android.content.context; import android.view.menu; import android.widget.toast; public class mainactivity extends activity { googlemap map; locationmanager lm; @suppr...

jquery - Display alert dialog on "a" click doesn't work -

i'm trying id of clicked element using jquery isn't working. jquery code: <script> $(function(){ $("a.step").click(function(){ var id = $(this).attr('id'); alert(id); }); }); </script> and html: <ul class="circle" id="categories"> <li><a id="option_6" class="step" href="#">cat2</a></li> <li><a id="option_7" class="step" href="#">cat3</a></li> </ul> what wrong in code? update i don't know cause out <script>...</script> code out of <body> tags , write in common.js , works :-o you trying id of a-link, aprent li has id. ;) so try $(this).parent('li').attr('id')

sql - Convert multi-dimensional array to records -

given: {{1,"a"},{2,"b"},{3,"c"}} desired: foo | bar -----+------ 1 | 2 | b 3 | c you can intended result following query; however, it'd better have scales size of array. select arr[subscript][1] foo, arr[subscript][2] bar ( select generate_subscripts(arr,1) subscript, arr (select '{{1,"a"},{2,"b"},{3,"c"}}'::text[][] arr) input ) sub; not sure mean saying "it'd better have scales size of array". of course can not have columns added resultset inner array size grows, because postgresql must know exact colunms of query before execution (so before begins read string). but propose converting string normal relational representation of matrix: select i, j, arr[i][j] a_i_j ( select i, generate_subscripts(arr,2) j, arr ( select generate_subscripts(arr,1) i, arr (select ('{{1,"a",11},{2,"b",22},{3,"c",33},{4,"d...

SAS: Compare values between two numbers to make separate buckets -

i'm trying compare multiple sets of data putting them in separate groups between 2 numbers. had statements like, if column1 gt 0 , column1 le 1000 price_group = 1000; i had going 1000 100,000. problem once counted how many in each price_group, price_groups missing (57,000 had no values when count(price_group) not appear groups). solution think make table bounds each, , compare actual value vs upper , lower bound. proc iml; mat = j(100,2,0); total = 100000; mat[1,1] = 0; mat[1,2] = mat[1,1] + (total/100); = 2 nrow(mat); mat[i,1] = mat[i-1,1] + (total/100); mat[i,2] = mat[i,1] + (total/100); end; create dataset mat; append mat; quit; this creates table can compare values, there easier way besides proc iml? next going loop compare each value 2 columns , create new column on table have count in each bucket. still seems intensive process inefficient. iml isn't terrible solution, there few others depending on you're doing. t...

nhibernate - use of ID generator from Oracle custom function -

i'm using nhibernate trying primary key id after insert (.saveorupdate() call). our oracle table generate pk id own custom function, sequence.nextval isn't correct id that's saved in table. how define mapping (.hbm.xml file) can actual id that's inserted table? i have following, sequence coming not valid one: <generator class="native"> <param name="sequence">seq_jobid</param> </generator> is there other way inserted pk client? thanks.

javascript - server code HTTP POST to the remote server - Django -

so i'm trying call api ajax. i've made ajax call local url. want local url make url call , return returned data. url restful. $.ajax({ type: 'post', datatype: 'application/json', accept: 'application/json', async: false, username: 'username', password: 'password', url: '/postdata/', data: { "name": "marcus0.7", "start": 500000, "end": 1361640526000 }, success: function(){alert('done!');}, error:function(error){alert(error)}, }); the api i'm trying call (in python): this want implement server side how do this? r = requests.post('https//extenal.api' ,headers={'content-type': 'application/json'}, auth=auth, data=json.dumps(data)) in django: views.py def postdata(request): return render(request, 'livestream/postdata.html') urls.py url(r'^postdat...

wordpress - What is wrong with my jQuery code? Gives error that it's not a function -

am using in wordpress, tried change $ sign jquery , did not work too. script: <script> jquery().ready(function($) { var name = $('#user-submitted-posts-wrapper').data('name'); if ( name != '') $('.usp-title input').eq(0).value(name); }); </script> and getting error: $(...).eq(...).value not function what might problem? trying prefill input field text get. input field has name attribute, no class or id attribute. better use? doing wrong? because $().value undefined (not function). the value property belongs htmlinputelement dom interface, jquery objects don't have property or method name. jquery objects provide .val() method set elements' value property: $('.usp-title input').eq(0).val(name); you may , set dom element properties directly retrieving dom element reference jquery object through .get method: $('.usp-title input').get(0).value = name; $(...

ruby on rails - thinking sphinx fails configuring development config -

i have installed thinking sphinx , after running rake ts:index , fails configure development file. file created, empty. generating configuration /users/lexi87/dating/config/development.sphinx.conf rake aborted! undefined method `type' nil:nilclass /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/attribute/type.rb:64:in `type_from_database' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/attribute/type.rb:17:in `type' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/attribute.rb:4:in `type' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb:30:in `sphinx_type' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb:18:in `collection_type' /users/lexi87/.rvm/gem...

android - jenkins uiautomator build always green -

so defined many uiautomatortestcase classes, each has 1 or 2 test cases @ most. use shell script on jenkins string these test cases series of tests, example: adb shell uiautomator runtest mytest.jar -c com.mytest.testclass1 adb shell uiautomator runtest mytest.jar -c com.mytest.testclass2 adb shell uiautomator runtest mytest.jar -c com.mytest.testclass3 adb shell uiautomator runtest mytest.jar -c com.mytest.testclass4 ... on forth. one of 2 (1/2) problems have jenkins builds, doesn't matter if of these test fails, jenkins shows green, need jenkins stop , shows red build. the other (2/2) problem if app crashes in 1 of tests, say, testclass2, script try pick , continue executing. best method make script stop? any suggestions? thanks thanks @keepcalmandcarryon , daniel beck, solved problem 2 steps: log adb output grep keyword log the code in shell script be: #!bin/bash function punch() { "$@" | tee ${workspace}/adb_output.log [[ -z "$(...

java - Searching for strongly connected components using neo4j -

i'm trying implement scc algorithm using neo4j storing graph. here implementation of dfs: void dfs(graphdatabaseservice g, node node, long counter) { transaction tx = g.begintx(); node.setproperty("explored", true); tx.success(); tx.finish(); system.out.println("exporing node " + node.getproperty("name") + "with depth " + counter); iterator<relationship> = node.getrelationships(direction.outgoing, reltypes.knows).iterator(); while (it.hasnext()) { node end = it.next().getendnode(); if (!(boolean) end.getproperty("explored")) dfs(g, end, ++counter); } } it throws stackoverflowerror. well, obvious reason depth of recursion getting big. maybe there wrong code? there's no need write own recursive dfs neo4j provides out of box. i'd rewrite method in following fashion: void dfs(graphdatabaseservice g, node node) { //neo4j provided trave...

javascript - Dynamically creating JQuery Mobile page from object -

i know it's possible create jquery mobile page dynamically writing out long string , appending page container. want create page object , append page container. this how used create pages: http://jsfiddle.net/pjucn/ var page = $("<div data-role='page' id='page'><div data-role=header> <a data-iconpos='left' data-icon='back' href='#' data-role='button' data-rel='back'>back</a><h1>dynamic page</h1></div> <div data-role=content>stuff here</div></div>"); page.appendto($.mobile.pagecontainer); $.mobile.changepage('#page'); this how want create them: http://jsfiddle.net/8nzmw/2/ var page = $('<div/>'), header = $('<div/>'), = $('<a/>'), title = $('<h1/>'), content = $('<div/>'); page.data('role', 'page'); page.attr('id', 'page...

vb.net - ComboBox ItemList SelectedValue -

vb.net (2010) i'm trying create combobox value , display items. here relevant bits of code. tried use datatable same result: private sub form1_load(sender object, e system.eventargs) handles me.load try cmbfromgroup.items.clear() itemlist.clear() item = new selectionitem(keyvalue, displayvalue) 'link combobox , item itemlist.add(item) cmbfromgroup.datasource = itemlist cmbfromgroup.displaymember = "display" cmbfromgroup.valuemember = "key" catch ex exception stop end try end sub private sub cmbfromgroup_selectedindexchanged(sender system.object, e system.eventargs) handles cmbfromgroup.selectedindexchanged try cmbfrommp3.items.clear() dim x string = cmbfromgroup.selectedvalue ' <snip> cmbfrommp3.selectedindex = 0 catch ex exception stop end try end sub public interface iselectionitem property key stri...

c - Optimizing my algorithm for multiplication modulo -

i have problem internet have array of n integers , have perform segment multiplication t times given left(l) , right segment(r) of array , return answer modulo given modulus(m). constraints n,t<=100000 1<=l<=r<=n m<=10^9 and integers <=100 ex- input 5(n) 2 5 8 9 4 4(t) 1 2 3 2 3 4 1 1 1 1 5 100000 output 1 0 0 2880 so have made solution problem little slow need tips optimize program. #include "stdio.h" int main(void) { int t; scanf("%d",&t); int array[t+1]; (int = 1; <=t; i++) { scanf("%d",&array[i]); } int n; scanf("%d",&n); (int = 0; <n ; i++) { long long a,b,c; scanf("%lld%lld%lld",&a,&b,&c); long long product = 1; if (c==1) { product = 0; } else { (int j = a; j <=b ; j++) { ...

asp.net mvc - Using backload to store files in database -

i'am trying use backload ( https://github.com/blackcity/backload ) upload images mvc application building. supposed able store images in database had no luck finding example demonstrates features. anyone had luck this? thanks i had similar requirement , didn't want use entityframework, how handled : custom controller : public async task<actionresult> uploadimage() { fileuploadhandler handler = new fileuploadhandler(request, this); handler.storefilerequestfinished += handler_storefilerequestfinished; actionresult result = await handler.handlerequestasync(); return result; } event handler method : void handler_storefilerequestfinished(object sender, storefilerequesteventargs e) { //i know expecting 1 file... var file = e.param.filestatus.single(); //call service layer method insert image data //you base64 encode stram here , insert straight in db service.insertpro...

Chrome extension development: Recommendable keyboard shortcuts -

i thinking of recommendable keyboard shortcut combinations used in order not conflict default keyboard shortcuts chrome or other application potentially conflicting on linux, windows or mac os x. which 1 consider 1 having best compatibility , lowest likelihood of conflicting other shortcuts on systems? alt+key alt+ctrl+key alt+shift+key alt+ctrl+shift+key looking @ chrome's keyboard shortcuts , alt + foo least-used singular modifying key combo, long foo != d , e , f , f4 , or home . there no ctrl + alt + foo shortcuts used chrome. ctrl + shift + foo feel quite comfortable chrome users, long foo != b , d , f , g , h , i , j , m , n , p , q , t , v , w , z , tab , esc , or del . you encourage user choose own shortcuts within chrome://extensions > keyboard shortcuts .

sql - More efficient way of doing multiple joins to the same table and a "case when" in the select -

at organization clients can enrolled in multiple programs @ 1 time. have table list of of programs client has been enrolled unique rows in , dates enrolled in program. using external join can take client name , date table (say table of tests clients have completed) , have return of programs client in on particular date. if client in multiple programs on date duplicates data table each program in on date. the problem have looking return 1 program "primary program" each client , date if in multiple programs on date. have created hierarchy program should selected primary program , returned. for example: 1.)inpatient 2.)outpatient clinical 3.)outpatient vocational 4.)outpatient recreational so if client enrolled in outpatient clinical, outpatient vocational, outpatient recreational @ same time on date return "outpatient clinical" program. my way of thinking doing join table previous programs multiple times this: from dbo.testtable testtable left...

oop - full inheritance behaviour with Decorator in php -

i'm not used design pattern generally, , never used decorator. want object can have different behaviour according context. these behaviours defined in different classes. guess decorator trick. need each decorator can access same properties, , call children methods first, inheritance. here i've done: abstract class component{ /** * used access last chain decorator * * @var decorator */ protected $this; protected $prop1;//these properies have accessed in decorators protected $prop2; protected $prop3; //this method used share properties childrens public function getattributesreferencesarray() { $attributes=[]; foreach($this $attr=>&$val) $attributes[$attr]=&$val; return $attributes; } } class foo extends component{ public function __construct() { $this->prop1="initialized"; //... } public function method1() {//this method ca...

Rails MySQL custom field, raw SQL on runtime -

when user opts create custom field email model contact(name,mobile), crime execute system command "mysql -u poi -pjuking db -e 'alter table contacts add column email varchar(255)" , somehow add :email attr_accessible in contact model....? do not this yes, altering source felony (what happens when running on multiple machines) need update cluster. same thing goes db. instead use hstore in postgres or serialize field custom attributes if on mysql.

c# - Repeater inside a repeater with jQuery accordion -

i did nested repeater according tutorial. same thing http://www.codeproject.com/articles/6140/a-quick-guide-to-using-nested-repeaters-in-asp-net but added jquery accordion example: http://www.snyderplace.com/demos/accordion.html everything good, realized ui issues. mean example if 1 of nested repeaters has 100 records , has 1 record, second 1 record, has blank space reserved had 100 records also. knows how fit height each nested repeater elements? <div id="accordion"> <asp:repeater id="summary" runat="server" onitemdatabound="summary_itemdatabound"> <headertemplate> </headertemplate> <itemtemplate> <div> id:<asp:literal id="litcategory" runat="server" /> </div> <div> <asp:repeater id="detail" runat="server" onitemdatabound="detail_itemdat...