Posts

Showing posts from August, 2013

ruby on rails - Looping hash but showing the entire set in last loop -

i have following code in rails 3.2: changeset: <%= @version.changeset %><br><br> length: <%= @version.changeset.length %><br><br> <%= @version.changeset.each_with_index |(key, value), i| %> <%= %> - <%= key %> - <%= value %><br> <% end %> output is: changeset: {"getting_there"=>["a", "b"], "description"=>["c", "d"]} length: 2 0 - getting_there - ["a", "b"] 1 - description - ["c", "d"] {"getting_there"=>["a", "b"], "description"=>["c", "d"]} i have no idea why last {"getting_there"=>["a", "b"], "description"=>["c", "d"]} showing. shouldn't shown. instead of: <%= @version.changeset.each_with_index |(key, value), i| %> you need have: <% @...

group by - Grouping an outcome in MySQL -

i'm doing simple mysql query , use group give me set of results of locations rather having run query uncommenting various lines on each occasion. i'm confused whether or not use group in select or clause. select count(*) users u -- northern ireland u.postcode_area in ('bt') -- wales -- u.postcode_area in ('cf','ch','gl') -- scotland -- u.postcode_area in ('ab','dd','dg','eh','fk') so outcome i'd see northern ireland | 25678 wales | 34543 scotland | 4567 you below: select (case when u.postcode_area in ('bt') 'northern ireland' when u.postcode_area in ('cf','ch','gl') 'wales' when u.postcode_area in ('ab','dd','dg','eh','fk') 'scotland' else 'other') country, count(*) users u group country

c# - Cause of high UDP package loss on localhost? -

in wpf 4.0 application, have udp listener implemented shown below. on windows 7 pc, i'm running both server , client on localhost . each received datagram scanline of larger bitmap, after scanlines have been received bitmap shown on ui thread. seems work. however, 1-50% scanlines missing. expect on weak network connection, not when run locally. what may cause udp package loss following piece of code? ipendpoint endpoint = new ipendpoint(ipaddress.any, port); udpclient = new udpclient(endpoint); udpclient.client.receivebuffersize = 65535; // i've tried many different sizes... var status = new udpstatus() { u = udpclient, e = endpoint }; udpclient.beginreceive(new asynccallback(udpcallback), status); private void udpcallback(iasyncresult ar) { ipendpoint endpoint = ((udpstatus)(ar.asyncstate)).e; udpclient client = ((udpstatus)(ar.asyncstate)).u; byte[] datagram = client.endreceive(ar, ref endpoint); // begin listening next packet not mi...

internet explorer - IE8 Some html is missing -

i have issue in ie8. part of html , script tags not displaying on page , not in firebug. not know why issue occur same page displaying perfect in ie9. in advance. it sounds tag opening/closing issue, suggest try , validate html on http://validator.w3.org/

use python to return json data of extjs treepanel -

i use python (django) extjs4.2, don't know how return json format data of extjs treepanel below: [{ "text":"a", "id": 1, "leaf":false, "parentid":0, "root":4, "children": [{ "text":"a_1", "id":2, "leaf":false, "parentid":1, "root":3, "children": [{ "id":7, "leaf":true, "parentid":2, "root":3, "text":"a_1_1", "children":[] }] }] }] please me, thanks. the structure of tree pretty easy understand: it's nested list of node every node's children property tree self. 1 can represent follow: class node(object): def __init__(self, id, text, root='', parent=none): self.text = text ...

node.js - Data coming through socket (nodejs) and push into Highchart -

[ background ] well, i'm using nodejs fetch value api , i'm getting values. , socket.io pushing values browser. [ requirement ] now, how can push values highchart draw chart. now, how can push values highchart draw chart. you need dynamically update chart new data. see official example how can it: http://www.highcharts.com/demo/dynamic-update

c# - Website is not taking connection string from web.config. it is searching for app.config -

i have project 3 tier structure dataaccesslayer, businesslogiclayer , website. in dataaccesslayer have used f# library project connectionstring accessing app.config file f# code - type dbschema = sqldataconnection<"","myconnection"> let connectionstring = system.configuration.configurationmanager.connectionstrings. ["myconnection"].connectionstring app.config code - <connectionstrings> <add name="myconnection" connectionstring="data source=myserver;initial catalog=mydb;persist security info=true;user id=sa;password=xyz;" providername="system.data.sqlclient"/> </connectionstrings> now have given reference of dll in website businesslogic , website project. i calling function of businesslogiclayer data - var mydatalist = businesslogic.getalldata().tolist(); now issue is, website searching connectionstring in app.config file instead of web.config. want take ...

bash - Parsing a comma-separated "key: value" string -

i have text file several blocks several lines may this: { key1: value, key2: value, key3: value, key4: value, key5: value } { key1: value, key2: value, key3: value, key4: value, key5: value } given key , how can corresponding values? note neither key names nor values have fixed length, blocks start , finish braces , pairs separated commas. my first try grep , cut , couldn't keys. guess should easy sed or awk , syntax confuses me lot. first solution grep: grep -o 'key5: [^, }]*' file shows someting like: key5: value key5: value to remove keys: grep -o 'key5: [^, }]*' file | sed 's/^.*: //' value value

javascript - Smooth scroll UI draggable -

i'm having problem jquery ui draggable.. i scroll element within smaller parent element, creates kind of viewport. however, i'm having issue element being dragged it's snapping edges of port. been battling while use help... please :) here example of behaviour i'm trying : link here jsfiddle : link and sample code: <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" /> <script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script> <script type="text/javascript" src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script> <!-- css --> <style type="text/css"> #port{ width:50px; height:100px; border:1px solid red; overflow:hidden; } #obj { width: 100px; height: 100px; border: 1px solid black; cursor: pointer; border-radius: 10px; text-align: center; background-color: lightpink...

Connecting to Couchbase 2.0 cluster via libcouchbase fails, when a single node is down -

i experiencing weird behavior when connection couchbase cluster consisting of several nodes. due redundancy set connection multiple ips described in documentation. track down problem tried connect single node this: $cb = new couchbase("<valid ip>", "<username>", "<password>", "<bucket>"); this works entirely fine. when replacing single ip array of ip - in order achieve redundancy. following output in error log: php warning: failed establish libcouchbase connection server: connection failure in ... php warning: there no active connection couchbase in ... the code connecting follows: $hosts = array(<invalid ip>, <valid ip>); $cb = new couchbase($hosts, "<username>", "<password>", "<bucket>"); in case above warning , libcouchbase not connect @ all. according documentation couchbase should try provided nodes , should not die on first "dead node...

javascript - Post to ActiveX - differing results between browsers -

i'm controlling activex control via javascript/jquery. control video player plays type of format require, standard players don't support. anyhow, 1 of api commands of player seek point in video, command goes along lines of... o = new playerobject("player"); o.createplayer(width, height); o.usemediaserver(ipaddress); o.usefile(file); o.play(); o.seek(30); //this doesn't work in chrome this works same across browsers, in terms of loading, playing, etc, difference in chrome, seek(secs) command doesn't seen send data correctly activex control, , result activex control cues to start of clip, it's interpreting data zero(0) instead of actual value. think boils down types, activex control expecting long. mozilla , ie seem send correctly, not chrome. i'm unsure go here, ideas? edit: it's plugin wraps activex link-to-plugin

ios - Objective-C/CocoaHTTPServer - Is it possible pass how response a NSString object? -

i'm using cocoahttpserver in project , need response simple request string. check incoming parameter , have created nsstring object string want return. don't know how return string. can't use "return xmllist" because xcode remember me pointer incompatible. server want result type nsobject. how can do? - (nsobject<httpresponse> *)httpresponseformethod:(nsstring *)method uri:(nsstring *)path{ httplogtrace(); if ([path isequaltostring:@"/getphotos"]){ nsstring *xmllist = [[nsstring alloc] init]; myservermethods* myservermethods = [[myservermethods alloc] init]; xmllist = [myservermethods getphotos]; nslog(@"return photos list %@", xmllist); } return nil; } thanks ok, have resolved problem in mode: if ([path isequaltostring:@"/getphotos"]){ nsstring *xmllist = [[nsstring alloc] init]; myservermethods* myservermethods = [[myservermethods alloc] init]; //first, create insta...

execute git commands on git push -

is there way execute couple of git commands when git push master? i'm having in mind is, once did git push grunt execute: git checkout gh-pages git merge master git checkout master why want use grunt execute these commands? think normal shell script suffice. assuming on linux, create executable file called post-receive in .git/hooks subdirectory, following contents: #!/bin/sh export git_work_tree=$git_dir/.. git checkout gh-pages git merge master git checkout master for more information search this page "post-receive hook".

Is it possible to checkout all files in binary mode from CVS? -

Image
i have cvs project called "merlin". when checkout entire project on linux files correct. when checkout project on windows there newline introduced after each line, causing failure script execution in few cases given below - code on linux - if key_name in self , isinstance(self[key_name], dict) , \ platform_name in self[key_name]: code on windows - if key_name in self , isinstance(self[key_name], dict) , \ platform_name in self[key_name]: this has happened 40+ py files , 1000+ errors introduced after cvs checkout on windows.. tortoise cvs client provides option.

Selecting Radio Button using JQuery only shows change after page refresh -

i have page setup using mustache, within page there radio buttons. if use $('input:radio[name=gender]')[0].checked = true; of of methods shown here , nothing works unless reload page. jquery block within jquery(document).ready(function() { tags. what problem, there way can refresh radio buttons? yeah not know why not mentioned in more places had similar problem drop down not doing wanted. guessing having same problem based on link methods trying. try this. $('input:radio[name=sex]:nth(0)').attr('checked',true).change(); the difference being .change();

c# - Error Debugging MVC 4 web application on IIS -

i using visual studio 2010 , have installed mvc 4. when debugging using vs development server sample web application works if try debug iis following error: could not load file or assembly 'microsoft.visualstudio.qualitytools.hostadapters.aspnetadapter, version=10.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a' or 1 of dependencies. system cannot find file specified. i not have references quality tools in web.config, have tried add them still did not work. tried o use aspnet_regiis tool in case. i have tried target different x64 or x86 platform did not make difference. my dev machine windows 7 64 bit you can find answer here this error caused mixed development environment. means have build service .net 4 @ x64 machine , else trying host service @ x86 development machine if doesn't work, check target framework 4.0

Django model manager queryset filter on aware datetime: no item display until server restart -

i have django model has publication_date , is_published fields. i've created manager model returns published items means: every item has is_published=true , publication_date <= now. class publishedtextmanager(models.manager): """ filters out unpublished items , items publication date in future """ def get_query_set(self): return super(publishedtextmanager, self).get_query_set() \ .filter(is_published=true) \ .filter(publication_date__lte=timezone.now()) the view that's using manager looks this: class newsandeventsoverview(listview): model = news queryset = news.published.all().order_by('-publication_date') context_object_name = 'news_list' def get_context_data(self, **kwargs): # initialize context , fill default data newsandeventsoverview super class context = super(newsandeventsoverview, self).get_context_data(**kwargs) # add ...

erlang - Site trap_exit down -

i new erlang , besides reading books , manuals, @ existing code. site trapexit.org looked nice, down. there out there restart thing, or better, there maintained, date code repository somewhere else? tia erlang central has of content trapexit - check documentation tab.

perl - Text::CSV parsing when data contains newline -

i have code parses csv file , data contains newline. text::csv breaks when encounters "\n" inside data this parse code use data::dumper; use text::csv; $csv = text::csv->new ({ binary=> 1, eol => $/, allow_loose_quotes => 1, allow_loose_escapes=> 1 }) || die $!; #print dumper($csv); $file = $argv[0]; open $csv_handle, $file or die $!; while (my $row = $csv->getline($csv_handle)) { print dumper($row); } this data 196766,31,"mr srinivasalu lakshmipathy\"dec\"\ \"71" 196766,56,"255233.47" you need set escape_char \ , defaults " . however, doesn't fix problem if run pure-perl version of text::csv . xs version ( text::csv_xs ), works: use strict; use warnings; use text::csv; use data::dumper; $csv = text::csv->new({ binary => 1, eol => "\n...

c# - CallerMemberName in an extension (INotifyPropertyChanged) -

i implementing extension inotifiypropertychanged interface, can read this: inotifypropertychanged - event stays null for furhter information. now extend extension further dont need state memberexpression , when calling inside set callermembername attribute rest. so have tried following (based on links provided in last stackoverflow question): public static void notify(this propertychangedeventhandler eventhandler, object sender, [callermembername] string propertyname = "") { if (eventhandler != null) { eventhandler(sender, new propertychangedeventargs(propertyname)); } } this allows me call method this: this.propertychanged.notify(this); //with callermembername this.propertychanged.notify(this, "randomproperty"); now remove neccessarity write (this, ..) parameter , call so: this.propertychanged.notify(); //with callermembername this.propertychanged.notify("randomproperty"); how possible? simply, isn...

android - Scaling animation on an already scaled view -

i'm animating imageview using following scale animations: <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:shareinterpolator="false"> <scale android:interpolator="@android:anim/accelerate_interpolator" android:fromxscale="1.0" android:toxscale="2.0" android:fromyscale="1.0" android:toyscale="2.0" android:pivotx="50%" android:pivoty="50%" android:duration="1000" /> <scale android:interpolator="@android:anim/accelerate_interpolator" android:fromxscale="2.0" android:toxscale="0.0" android:fromyscale="2.0" android:toyscale="0.0" android:pivotx="50%" android:pivoty="50%" ...

php - Problems with PayPal IPN - redirect and post data -

after users have been redirected paypal , completed payment, redirected site (ipn.php). however, turns out sends user using http method. i'm using following ipn listener: https://github.com/quixotix/php-paypal-ipn/blob/master/ipnlistener.php however, says "invalid http request method" when user arrives on ipn.php page. it's supposed post data , redirect user. missing paypal setting here or something? really appreciate on this. the paypal ipn not occur when redirect users site. users redirected normal confirmation page. the ipn request happens later. delay can vary quite , occurs when transaction has been confirmed. it's webservice call paypal system.

php - "Fatal error: Call to undefined function" resulting in particular local server, but ran well in others' -

i'm developing php application generating reports pdf right i'm facing troubles i'm working own computer xampp server , code ran well when copied codes office's wamp5 version 1.6.5 server got errors fatal error: call undefined function array_fill_keys() in d:\wwwroot\tcpdf\include\tcpdf_fonts.php on line 1848 i went troubled line , removed it, fatal error: call undefined function occured there wrong wamp5 configuration? thanks your version of php old... royal bg suspected. either upgrade 1.6.6 php 5.2. if there no reason use such old version switch less 7 years old :) see: http://sourceforge.net/p/wampserver/news/?source=navbar

java - how to run after compiling thru gradle? -

i using java plugin in build.gradle. apply plugin: 'java' repositories { mavencentral() } dependencies { compile 'xyz:xyz:4.11' } sourcesets { test { java { srcdir 'agent' } } } i generating .class files doing $ gradle compilejava now .class files have been generated in build/, how run code? 1 of class files contains main. want gradle task: classpath=./mysql-connector-java-commercial-5.1.13-bin.jar:. $java_home/bin/java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=10000 collector arg1 you may want take @ gradle application plugin . with it, able run application using run task.

continuous integration - Octopus Deploy On Same Machine -

i've started using tool , far seems brilliant. i'm struggling head around how organise in tool though. i have website , api deploy. i have 1 project set , 3 environments, staging, uat , live. i have 1 tentacle 2 roles executing on development machine. i can see deployments environments being built in apps directory. what i'm struggling getting head around how these different players should configured. what i'm struggling on same machine want 2 steps ( api step, web step) different based on environment. so when deploying api step staging goes c:\staging\api when deploying uat goes c:\uat\api . i can't see how can since step defined separately environments far can tell. it seems octopus deploy assumes there @ least 2 machines involved in case you'd never want anyway, @ least can't think would. is arrangement possible in octo? you should able use variables achieve after.

C++ unexpected behaviour (where are my temporaries!?) -

this r-value experiment mutated when gcc whined me lack of move-constructor (i'd deleted it) , didn't fall-back copy constructor (as expected) removed -std=c++11 flags , tried see below, has lot of output (it didn't initially) because trying work out why doesn't work (i know how debug find messages on stdout indicator of happening) here's code: #include <iostream> class object { public: object() { id=nextid; std::cout << "creating object: "<<id<<"\n"; nextid++; } object(const object& from) { id=nextid; std::cout << "creating object: "<<id<<"\n"; nextid++; std::cout<<"(object: "<<id<<" created object: "<<from.id<<")\n"; } object& operator=(const object& from) { std::cout<<"assigning "<<id<<" "<<from.id<<"\n"...

java - Android Native C++, work with threads -

i want execute computation intensive c++ code through android ndk. c++ part not directly access harddisk or peripherals. necessary put c++ part thread because of long computations , because app has other frequent duties perform. is possible use java threading in case (e.g. java wrapper thread containing c++ part)? or need create threads within c++ part itself? you can choose path take both available. it's easier create new thread @ java level, , within thread call native method... won't require doing special @ c++ level.

r - Create counter with multiple variables -

this question has answer here: numbering rows within groups in data frame 2 answers i have data looks below: customerid tripdate 1 1/3/2013 1 1/4/2013 1 1/9/2013 2 2/1/2013 2 2/4/2013 3 1/2/2013 i need create counter variable, below: customerid tripdate tripcounter 1 1/3/2013 1 1 1/4/2013 2 1 1/9/2013 3 2 2/1/2013 1 2 2/4/2013 2 3 1/2/2013 1 tripcounter each customer. use ave . assuming data.frame called "mydf": mydf$counter <- with(mydf, ave(customerid, customerid, fun = seq_along)) mydf # customerid tripdate counter # 1 1 1/3/2013 1 # 2 1 1/4/2013 2 # 3 1 1/9/2013 3 # 4 2 2/1/2013 1 # 5 2 2/4/2013 2 # 6 3 1/2/201...

java - Differ behavior of a junit-test based on success or no success -

this question has answer here: junit conditional teardown 1 answer i have unit-tests setup @before-method , cleaned @after-method. want @after-method different if test succeed if failed. how can this? you need use boolean flag in @after method decide want in case of success or failure. can define flag ispassed in test class, turn true if test case passed or turn false in case of failure. read variable in @after method , decide need do.

extjs - load Data from local store -

i'm facing diffculties loading specific data records frome local store app's views. the store looks this: ext.define('xyz.store.userdatastore', { extend: 'ext.data.store', requires: [ 'xyz.model.user' ], config: { autoload: true, autosync: true, model: 'xyz.model.user', storeid: 'mystore', proxy: { type: 'localstorage', id: 'id' } } }); the model looks this: ext.define('xyz.model.user', { extend: 'ext.data.model', config: { fields: [ { name: 'token', type: 'string' }, { name: 'title' }, { name: 'login' }, { name: 'facebookid' }, { name: 'firstname', type: 'string' }, { name: 'lastname', type: 'string' }, { name: 'nationality', type: 'string' }, { name: 'birthday', type: 'string' }, { name: 'phone' }, { name: 'mobile' }, { name: 'street' }, { name:...

How to call a stored procedure in oracle from shell -

i have installed cygwin , have oracle 10 g want connect database shell.can me?? sql> create or replace procedure get_area 2 (n_length in number, 3 n_width in number, 4 n_area out number) 5 6 begin 7 n_area := n_length*n_width; 8 end get_area; 9 / this procedure have created in oracle 10g.i want call get_area shell i doing start process subho@subho-pc ~$ #!/bin/csh-f you can this sqlplus login/pass @get_area.sql where get_area.sql contains sql code the last detail put exit; @ end of script oftherwise stay on sql > prompt

javascript - Legend in Multi line chart - d3 -

Image
while adding legend multi line graph result is: the passed ,failed etc... half visible. code: var margin = {top: 20, right: 20, bottom: 30, left: 50}, width = 1090 - margin.left - margin.right, height = 339 - margin.top - margin.bottom; var x = d3.scale.linear() .range([0, width]); var y = d3.scale.linear() .range([height, 0]); var color = d3.scale.category10(); var xaxis = d3.svg.axis() .scale(x) .orient("bottom"); var yaxis = d3.svg.axis() .scale(y) .orient("left"); var line = d3.svg.line() .interpolate("linear") .x(function(d) { return x(d.days); }) .y(function(d) { return y(d.testruns); }); var svg = d3.select("#application_status_graph").append("svg") .attr("width", width + margin.left + margin.right + '0%') .attr("height", height + margin.top + margin.bottom) .append("g") .attr("transform", "translate(" + margin.left + "," + margin...

javascript - retrieving cached pages -

i have simple website created using javascript , jquery. website contains 4 web pages , hosted on web server. issue want able navigate through these 4 pages when don't have access server (no wifi or otherwise). way i'm linking pages (if has effect) using window.location.href="page1.html"; the click function 1 of buttons on home page so $("#btnone").click(function() { window.location.href="page1.html"; return false; }); i thought of using post on jquery website says "pages fetched post never cached" is there effective way accomplish want; having pages cached browser available use offline? cache manifest # 01-aug-13 215 cache: css/stylesheet.css css/custom-theme/jquery.mobile-1.3.2.min.css home.html page1.html page2.html js/jquery-1.9.1.min.js <!doctype html> <html manifest="cache.manifest"> <head> <meta charset="utf-8"> <meta name="viewport" conten...

xml - XPath expression to create text delimited string -

edit: appears software supports xpath 1.0. :( i need create delimited string of following format: stuff,things;a,1;b,2 from following xml data: <table ss:expandedcolumncount="2" ss:expandedrowcount="3" x:fullcolumns="1" x:fullrows="1" ss:defaultrowheight="15"> <row> <cell><data ss:type="string">stuff</data></cell> <cell><data ss:type="string">things</data></cell> </row> <row> <cell><data ss:type="string">a</data></cell> <cell><data ss:type="number">1</data></cell> </row> <row> <cell><data ss:type="string">b</data></cell> <cell><data ss:type="number">2</data></cell> </row> </table> columns denoted , , rows denoted ; . should create 2 dimensional array. --...

mysql - How do I properly index a query that selects multiple fields when using GROUP BY and ORDER BY? -

my issue we have email engine sends users emails either in blocks (same email many users: ie, bulk newsletter) or singleton cases (one email 1 user: ie, password reset). have admin console displays log of emails have been sent out. right now, table has around 750,000 rows. every email sent, following logged in table (trimmed down main items): id batch_id user_id subject send_date created if batch email sent out, emails in batch have same batch_id . when admin browsing logs console, don't want display emails batch within table results - unique one. did this: select id, batch_id, user_id, subject, send_date, created `emails` group batch_id order created desc limit 10 this works, slow. result of our explain on our query: +----+-------------+-------------+-------+---------------+----------+---------+------+------+---------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | ...

arrays of arrays with different length in java -

my question can declare arrays in passion int college[][][]; it contains 3 blocks departments, students, marks i need 5 students in 1 department , 6 students in department can declares arrays this. if how? int college[][][] = new int[3]; college[0] = new int[5]; college[1] = new int[6]; ... college[0][0] = new int[count_marks_dept1_student1];

C++ adding static libcurl, wont compile -

im using eclipse , mingw32. problem when add -static flag linker options, receive error message: mingw32/bin/ld.exe: cannot find -llibcurl without -static flag, combines fine , works. compiled libcurl using mingw32. copied header files mingw include folder, , files libcurl lib folder mingw lib folder. i'm doing wrong, dont know what. -static means "do not link against shared libraries." when not use options linker links binary shared version (libcurl.so on linux/libcurl.dll on windows). not have static version of libcurl on development enviroment or not give right path of file (libcurl.lib).

dialog - How to resize a DialogBox in GWT so that a FlexTable fits in? -

i want use flextable in dialogbox . size of dialogbox should match size of flextable . unfortunately, dialogbox smaller, flextable cut , parts of visible. there way automatically resize dialogbox flextable fits? (please note, flextable not change while being displayed, there not automatic resizing necessary once shown on screen...) did accomplish this? i think found out wrong. in addition bryan's great answer might in such situations (though in mine there no change between automatic sizing , bryan's approach). found out when using animations, width of dialogbox in gwt limited 400 px. when changing line setanimationenabled(true); to setanimationenabled(false); the sizing of dialogbox works fine. maybe helpful someone...

java - Prevent duplicate values in an array -

how can ask user reenter again if value pid existed in array ? ex: enter b , enter again, entered last not accepted because it's existed. int[] process = {}; int numberofprocess = 0; string[] pid = new string[10]; //proces id system.out.print("enter number of process 1 10 : "); while(berror){ if(scan.hasnextint()){ numberofprocess = scan.nextint(); }else{ scan.next(); continue; } berror = false; } //---------------- ask user input process id @ , ex ------- for(int i=0;numberofprocess > i;i++){ system.out.print("please enter processid " + (i + 1) + " : "); pid[i] = scan.next(); } i'd not use array linkedhashset (assuming want preserve input order). check using set's contains(...) method or try add pid using add(...) , check return value (false if has not been added, i.e. if existed in set).

mysql - Delete from subquery -

i using hibernate in application. trying execute following query: delete activetimes a.begin>=:from , a.begin<=:to , a.end>=:from , a.end<=:to , in( select al activetimes al join al.source.stage st join st.level.datasource ds ds=:datasource) but error: column 'id' in field list ambiguous . feels normal, because created sql query looks this: delete active_times begin>=? , begin<=? , end>=? , end<=? , ( id in ( select id active_times activeti1_ inner join sources sourc2_ on activeti1_.source=sourc2_.id inner join stage stage3_ on sourc2_.id=stage3_.source inner join levels levels4_ on stage3_.level=levels4_.id inner join datasources dat...

android - tableview not being displayed -

i'm using code bird library integrate twitter feed titanium app. @ minute i'm interested in text , image. getting these elements fine in console , entire code getting no errors, however, table not appearing in app. have replaced key , secret key correct values. see code below: var tableview= titanium.ui.createtableview({ zindex:60 }); var rowdata; var win= titanium.ui.createwindow({ backgroundcolor:"white" }); var codebird = require("codebird"); var cb = new codebird(); cb.setconsumerkey('consumer key', 'consumer secret'); var bearertoken = ti.app.properties.getstring('twitterbearertoken', null); if(bearertoken == null){ cb.__call( 'oauth2_token', {}, function (reply) { var bearer_token = reply.access_token; cb.setbearertoken(bearer_token); ti.app.properties.setstring('twitterbearertoken', bearer_token); fetchtwitter()...

css - CSS3 Selectors - style hashtag-words -

i've searched lot, still cant find way use css3 selectors style words starting #... #diy. shouldnt possible using css-only? no, can quite done javascript. using extend jquery.highlight highlight regular expressions : $('body').highlight(/\b#\w+/) working example: http://jsfiddle.net/kobi/ttd9r/

python - Is there a way to add multiple filemasks in wx.lib.filebrowsebutton.FileBrowseButton? -

i'm trying make wx.lib.filebrowsebutton.filebrowsebutton button match both txt , csv files, doesn't seem support glob pattern described, *.{txt,csv} ends matching nothing on windows , literally tries files extension of {txt,csv} . so how make work both txt , csv files? the documentation not clear. should using semi-colon inside parenthesis, so: "txt , csv files (*.txt; *.csv)|*.txt; *.csv" you can add second line so: "txt , csv files (*.txt; *.csv)|*.txt; *.csv|png files (*.png)|*.png"

R building a subset based on value in previous row -

i have problem figuering out: suppose how data looks like: num condition y 1 1 2 2 3 3 4 b 4 5 b 5 6 b 6 7 c 7 8 c 8 9 c 9 10 b 10 11 b 11 12 b 12 i want make calculation (e.g., mean) on b, depending on whether value in row before b, in example or c? help!!! angelika is want? # in order separate between different runs of condition 'b', # length , value of runs of equal values of 'condition' rl <- rle(x = df$condition) df$run <- rep(x = seq_len(length(rl$lengths)), times = rl$lengths) # calculate sum of y, on data grouped condition , run, , condition 'b' aggregate(y ~ condition + run, data = df, subset = condition == "b", sum)

javascript - jQuery autocomplete select first when click outside -

i using autocomplete plugin , want item focused being selected if don't click on it, instead click outside of input field. $('#adress_input_box').tagsinput({ 'width':'500px', 'removewithbackspace': false, 'defaulttext': 'strasse, ort, plz oder gemeinde eingeben', 'placeholdercolor': '#aaacab', 'onremovetag': function(event){ //do stuff here }, onaddtag: function(e){ //do stuff here }, interactive: true, autocomplete_url: '/includes/autocomplete.php', autocomplete:{ close: function(event, ui){ allowcreatingtag=false; }, select: function(event, ui){ //stuff }, source: function( request, response ) { $.ajax({ url: "/includes/autocomplete.php", datatype: "json", type: "post", data: { ...

deployment - Errors in Deploying workbrain through weblogic -

Image
so i'm kind of new using weblogic, i've been trying deploy ear file onto weblogic, (a workbrain ear file exact). have tried exploding ear file , deploying folder , deploying ear file directly following errors after click deploy : i have gone through google , found out things edit xml files, not sure if ear file (it shouldn't be) or weblogic server itself. said view log files im not sure located any ideas of how tackle issue?

jquery - Any good way to save an unsubmitted form? -

i know it's difficult task, there way save form input when user navigates different page without submitting, when come won't have re-enter info? i'm using rails 4, simple form, , jquery, i'm open solution isn't ugly hack. the jquery serialize function may friend here. serialize on way out , save db or localstorage , reverse when come page. http://api.jquery.com/serialize/ alternatively loop through elements , store them in array/object store in localstorage , on re-entry re-populate values of form accordingly.

jsf 2 - How to start special init event in a backing bean before JSF page loads? -

pf 3.5.10, mojarra 2.1.21, omnifaces 1.5 how call special init()-method of (cdi)sessionscoped bean before load .xhtml jsf page ? call init() if user select page site menu (with p:menutitem ). if user use browser address line type url directly? edit: my.xhtml : <ui:define template="/mytemp.xhtml"> <f:event type="prerenderview" listener="#{mybean.init()}" /> <h:form> <p:commandbutton update="@form" ... /> </h:form> </ui:define> if way init() called on every update (i.e. on every postback server),in example on every click of commandbutton. can not use proposal. edit 2: thank luiggi mendoza, , balusc! in addtion solution luiggi mendoza, in comments stated omnifaces 1.6 have viewscope also. the problem @postconstruct public void init() method called after managed bean created , fields injected. since bean @sessionscoped , live until user session expires. a way solve use <...

vb.net - Textbox border property for a Textbox in .net 2.0 -

in vb.net textbox not have border color property. want control border color property. have tried code mentioned in this link . using able create control can added visual studio , can used. works fine me .net 3.5 target projects. not work .net 2.0 targeted project. border color not change.i have tried building control(dll) using .net 2.0 target , adding project didn't work. please me on or alternative it an easier solution may draw rectangle around textbox , set textbox border nothing

Flask import error (python) -

trying import flask error: importerror: no module named flask after: import flask i installed using terminal (mac os x): joedangers-macbookpro:~ joedanger$ $sudo easy_install flask searching flask best match: flask 0.10.1 processing flask-0.10.1-py2.7.egg flask 0.10.1 active version in easy-install.pth any thoughts why not working? the module called flask : from flask import flask

sql - Add Index to Existing MySQL Table -

i have database in tables in use no index defined. i'm looking increase speed if possible. have ready on indexes, wondering need primary key well? also, index null old records in table. issue? i'm wondering best approach is. here current table stucture (i planning on inserting 'id' index) field type collation attributes null user varchar(255) utf8_general_ci no pass varchar(255) utf8_general_ci no ts varchar(255) utf8_general_ci no lat varchar(255) utf8_general_ci no try this:- create fulltext index `idxtags` on `table1`(`tags`) and if want can try also:- alter table tablename add id int not null auto_increment primary key; this add unique index on rows.

java - JSF PropertyNotFound Exception on Tomcat 6 outside of Eclipse -

i have app runs on tomcat 6 in eclipse. when take app , manually deploy same tomcat server outside of eclipse , run it, javax.el.propertynotfoundexception when trying access many of pages. how can propertynotfoundexception when running app outside of eclipse, not in eclipse? stacktrace when trying access page: aug 28, 2013 9:40:30 com.sun.faces.application.view.faceletviewhandlingstrategy handlerenderexception severe: error rendering view[/ccadmin/publications/search.xhtml] javax.el.propertynotfoundexception: /ccadmin/publications/search.xhtml @107,92 value="#{pubbacker.beginyear}": property 'beginyear' not found on type com.ccadmin.backing.publicationbacker @ com.sun.faces.facelets.el.tagvalueexpression.getvalue(tagvalueexpression.java:111) @ javax.faces.component.componentstatehelper.eval(componentstatehelper.java:194) @ javax.faces.component.componentstatehelper.eval(componentstatehelper.java:182) @ javax.faces.component.uioutput.getvalu...

android - Is it possible to work with Dropbox REST API without any libraries, using only GET&POST requests? -

also preferably no start web-browser user logging-in. instance, es file manager shows form within own fragment. i need application small, while of libraries of few megabytes. you can access api without library, authentication requires oauth (which requires opening browser). calls core api http header authorization: bearer <token> , http library do. example, curl command write file called hello.txt : curl -x put https://api-content.dropbox.com/1/files_put/auto/hello.txt?overwrite=false \ -h 'authorization: bearer <your_token>' \ -h 'content-type: text/plain' \ -d 'hello, world!' see blog posts how call core api from command-line curl , how variety of languages without using oauth or dropbox library .

gac - Could not load type '' (blank) error when trying to reference .NET assembly in NAV2013 -

i've created assembly want able call c/side in role-tailored client in dynamics nav2013. i've got working locally when trying deploy server can't compile codeunit references .net assembly i have variable of type dotnet when trying choose subtype error: could not load type '' <-- nothing between single quotes! i've followed steps in msdn guide (save exporting types want use) i've got working locally. can running installing assembly gac, don't want have when should work otherwise (the add in registered in client add-in table , strong-named correct public key token in table) these things i've tried: building .net 4.5, 4 , 3.5 of worked locally not on server dropping dll in client , service add-ins folder dropping dll windows/system32 folders running administrator (dev environment, service etc etc - i'm logged on domain administrator) ripping clumps of own hair out all assembly calls out webservices , couple of other t...

Python arguments cuts at < when reading from command line -

i got script supposed take time takes execute python -script. simplicity supply actual command want execute arguments in commandline. say call: python time.py python ratatosk.py < input.txt here after python time.py actual command want execute. however, when reading sys.argv this: print 'number of arguments:', len(sys.argv), 'arguments.' print 'argument list:', str(sys.argv) it returns: number of arguments: 3 arguments. argument list: ['time.py', 'python', 'ratatosk.py'] where did rest of arguments go? looks < somehow stripped away. i running python python 2.7.3 (v2.7.3:70274d53c1dd, apr 9 2012, 20:52:43) on macbook pro. you need escape < sign. try calling: python time.py python ratatosk.py \< input.txt it might better use different character < running command easier

ruby on rails - can't connect to postgres server with mountain lion -

need after scouting issues postgres , mac 10.8 i installed pg through homebrew (tried heroku app no luck) which psql --> /usr/local/bin/psql psql --version --> psql (postgresql) 9.2.4 when starting rails server is server running locally , accepting connections on unix domain socket "/var/pgsql_socket/.s.pgsql.5432"? when pg_ctl -d /usr/local/var/postgres -l logfile start server starting when run psql is server running locally , accepting connections on unix domain socket "/tmp/.s.pgsql.5432"? any idea? whatever wrong setup ended adding host: localhost to database.yml and did trick. time wasted remain now. help.

java - Assert that collection "Contains at least one non-null element" -

i want verify collection contains @ least 1 non-null element. have tried is(not(empty())) , passes in test below. import org.junit.test; import java.util.arraylist; import java.util.collection; import static org.hamcrest.corematchers.is; import static org.hamcrest.matcherassert.assertthat; import static org.hamcrest.matchers.empty; import static org.hamcrest.matchers.not; public class sandboxtest { @test public void shouldtestthis() { collection<integer> collection = new arraylist<integer>(); collection.add(null); assertthat(collection, is(not(empty()))); } } is there elegant/simple way this? things don't work @test public void should(){ collection<string> collection = new arraylist(); collection.add("gfas"); collection.add("asda"); assertthat(collection, contains(notnullvalue())); } java.lang.assertionerror: expected: iterable containing [not null] but: not matched: ...

Calling stored procedure from Hibernate / MySQL: Parameter index out of range (3 > number of parameters, which is 2) -

i receive following error when calling insert stored procedure in hibernate while working mysql db: hibernate: { call insertpayment(?, ?) } sie 28, 2013 10:17:19 pm org.hibernate.engine.jdbc.spi.sqlexceptionhelper logexceptions warn: sql error: 0, sqlstate: s1009 sie 28, 2013 10:17:19 pm org.hibernate.engine.jdbc.spi.sqlexceptionhelper logexceptions error: parameter index out of range (3 > number of parameters, 2). exception in thread "main" org.hibernate.exception.genericjdbcexception: not insert: [model_mapping_xml.tpayment] stored procedure definition in mysql db: create procedure insertpayment( in pidanother int, in pamount decimal(19,4) ) begin ... end tpayment.hbm.xml file contains: <sql-insert callable="true" check="none"> { call insertpayment(?, ?) } </sql-insert> implicit call of stored procedure: // calli...