Posts

Showing posts from July, 2012

Android Drawble XHDPI only - avoid lint warning -

in project have drawables used in case of tablets. if put images on xhdpi, lint complains image should in other dimensions too. ignoring lint best approach in situation? you can place image in drawable-nodpi or in drawable folder. not exist default need create folders in resources

javascript - How do I force lowercase on an input field? -

i have input field client wants lowercase only. output generates input lowercase. this have , isn't working. <script> function tolowercase(email) { strinput.value=strinput.value.tolowercase(); } </script> use oninput : var input = document.getelementsbytagname("input")[0] // input element input.oninput = function() { input.value = input.value.tolowercase() } <input type="text" />

mysql - How can I combine two queries with a having clause into one? -

i hope can me these 2 queries query: select count(distinct id), sum(amount) sales year(saledate) = '2015' , saletype ='cash' group customer having sum(amount) >=500; select count(distinct id), sum(amount) sales year(saledate) = '2015' , saletype ='creditcard' group customer having sum(amount) >=1000; what best way combine them one? aim select cases customer paid more 500 in cash or more 1000 via creditcard. thanks lot help. in case can use example: select count(distinct id), sum(amount) sales year(saledate) = '2015' , saletype ='cash' group customer having sum(amount) >=500; union select count(distinct id), sum(amount) sales year(saledate) = '2015' , saletype ='creditcard' group customer having sum(amount) >=1000; or union if want records without distinct . select count(distinct id), sum(amount) sales year(saledat...

multithreading - What's the cost/overhead of thread context switch? -

what's cost/overhead of thread context switch? far know, there direct costs: saving , restoring context(generally,it includes general purpose registers , program counter) costs of thread scheduling(deciding thread next run) and there maybe indirect costs, such as: if thread switched out arranged run in cpu later, might re-load variables main memory(or other cpu via coherence protocol), cache read miss might occur. is there other indirect costs?

PostgreSQL - text Array contains value similar to -

i'm trying rows column of type text[] contains value similar user input. what i've thought , done far use 'any' , 'like ' operator this: select * sometable '%someinput%' any(somecolum); but doesn't work. query returns same values query: select * sometable 'someinput' = any(somecolum); i've got result using unnest() function in subquery need query in clause if possible. why doesn't like operator work any operator , don't errors? thought 1 reason should any operator in right-hand of query, ... is there solution without using unnest() , if possible in where clause? it's important understand any not operator sql construct can used right of operator. more: how use instead of in in clause rails? the like operator - or more precisely: expression , rewritten ~~ operator in postgres internally - expects value left , pattern right. there no commutator operator (like there simple equali...

NULL values in ACCESS reports? -

i created simple report has 5 columns (companyname, bought, sold, returned, total) looks like. companyname bought sold returned total with exception of company name, every value number. created simple queries bought, sold , returned. total used arithmetic in main query (basically sum of bought, sold, returned (returned negative)). problem came across companies, of columns (bought,sold,returned) null since ex: don't have returned when run report, doesn't show me value total. unless have values in three(bought sold , returned) - nothing gets displayed in total. don't want display zeros in report because clustered, there way me convert null 0 when calculation , hide report?

java - Is Unitils project alive? -

anybody knows whether unitils project still alive. on there pages last version 3.3 in maven repository 3.4.2.(actually there google cached version of pages version said 3.4.2) anyway there replacement project. kind of lack vivid community around , don't want bound dying project. unitils seems abandoned nowadays. project available on github here , can @ history , activity. anyways 2 cents... unitils has serious drawbacks: integrates many third-party libs (easymock, dbunit, spring, dbmaintainer, xmlunit, slf4j etc) , forces versions - serious drawback due being dependent on many 3rd party libraries, impossible keep date without company behind. unitils 4.0 developed since 06.2011 , planned release @ 01.2012, (01.2016) after 4 years still not released. dbunit for database-driven apps may seem interesting way go plain dbunit + spring-test or alternatively 3rd party tools: excilys/spring-dbunit comes handy @dataset annotation , actively developed on ...

javascript - AngularJS - directive not working -

i angularjs newby. trying display image using template of angularjs directive , on click of image want marker placed on image. don't know why not working. the first directive: directive('hello', function() { return { template: '<img id="map" src="http://www.lonelyplanet.com/maps/asia/india/map_of_india.jpg" />', link: function(scope, element, attrs) { $('#map').click( function(e) { $('#marker').css('left', e.pagex).css('top', e.pagey).show(); } ); }, }; }); the html code <hello> <img id="marker" src="http://maps.google.com/mapfiles/ms/micons/blue.png" style="display: none; position: absolute;" /> </hello> you missing restrict : 'e' option, default restrict has value ac attribute , class, in case using directive...

Java 8 Incompatible Types -

here's simple code import java.util.arraylist; import java.util.collections; import java.util.hashmap; import java.util.map; public class simpletest { public static void main(string[] args) { final arraylist<map<string, object>> maps = newarraylist( createmap("1", "a", collections.empty_map, collections.empty_map), createmap("2", "b", collections.empty_map, collections.empty_map), createmap("3", "c", collections.empty_map, collections.empty_map) ); system.out.println(" maps = " + maps); } public static map<string, object> createmap(string value1, string value2, map<string, object> object1, map<string, object> object2) { map<string, object> map = new hashmap<>(); map.put("value1", value1); map.put("value1", value1); map.put("object1", object1); map.pu...

php - Custom query for database in Laravel -

first of i'm wondering if possible in laravel? i have code: $master_array = $_post['master_search_array']; $count = count($master_array); $master_string = ''; for($i=0; $i<$count; $i++) { if($master_array[$i] == "dining"){ $master_string .= "where('dining', 'dining')"; } if($master_array[$i] == "party"){ $master_string .= "where('party','party')"; } ....etc point } $tours = db::table('tours')->$master_string->get(); return $tours; so @ end should this: $tours = db::table('tours')->where('dining', 'dining)->where('party','party')->get(); how can in laravel, gives me error, no matter if pass $master_string or {{$master_string}} . there no need master string. use query builder how it's meant used... $master_array = $_post['master_search_array']; $coun...

sql - Syntax error using LEN() with varchar -

can advise correct syntax below. @test len(right(@test, charindex('/',@test) 1)1) + ' ' + left(@test, charindex('/',@test) 1) + ' ' +invoice_booking.dptr_date + ' ' + invoice_booking_detail.destination_name [as] description i added len() want limit first result 1 character i have declared @test declare @test nvarchar(100) set @test = invoice_booking_detail.principal_passenger cheers dave wrong syntax near len(),left(),right() @test len(right(@test, charindex('/',@test))) + ' ' + left(@test, charindex('/',@test)) + ' ' +invoice_booking.dptr_date + ' ' + invoice_booking_detail.destination_name [as] description

python - Pythonic way to find what's wrong with a json file -

i working on script convert json data panadas.dataframe / numpy.array . when json ok there no problem when there wrong got general error telling me not correct json format. i looking pythonic know what's wrong json. can point error in json file. for example: with ths json, ok, [ { "col1": value1, "col2": value2, "col3": value3, "col4": value4, "col5": value5, "wpid": xxxxxx }, { "col1": value1, "col2": value2, "col3": value3, "col4": value4, "col5": value5, "wpid": xxxxxx }, { "col1": value1, "col2": value2, "col3": value3, "col4": value4, "col5": value5, "wpid": xxxxxx } ] but this: [ { "col1": value1, ...

security - Add stack protection removal flags to apache compilation script -

for study purposes i'd test buffer overflow exploits on old 1.3.x version of apache webserver. anyway have stack protection on, doesn't work or @ least think doesn't reason. in order disable protections have compile these flags: -fno-stack-protector -z execstack but don't know how add them apache compilation process..i never did this! can me? try: cflags="-fno-stack-protector" ldflags="-z execstack" ./configure [...] cflags compiler, execstack linker option, should go in ldflags . or, if supported can compiler pass linker options -with -wl , so: cflags="-fno-stack-protector -wl,-z,execstack" ./configure [...] see install file in apache source archive more details. it's useful inspect or compare generated top-level makefile , should see parameters in either or both of extra_cflags , extra_ldflags . given task have, if you're running linux distribution has periodic pre-linking , aslr task, should ch...

sql - Trying to Get 15 Minute Intervals from MySQL Database -

Image
i have sql string trying count in 15 minute intervals previous day. not show rows after 12pm. ideas? select count(*), minute(`que_timestamp`) div 15 `peorid`, hour(`que_timestamp`) `hour` `que` date (`que_timestamp`) = (curdate() - 1) group hour(`que_timestamp`), minute(`que_timestamp`) div 15 order `hour` asc my que_timestamp mysql timestamp

vb.net - How do you allow only numbers, backspace, and hyphens in a text box in Visual Studio 2010? -

if (e.keychar < "0" orelse e.keychar > "9") andalso e.keychar <> controlchars.back andalso e.keychar = "-" e.handled = true i can't seem code working. trying include text box enter numbers, backspace, , hyphens working, hyphens not working, other work. help? use maskedtextbox. it's pretty useful control. without coding allows specify characters allowed in textbox, think looking for.

visual studio 2010 - CMake: How to add a .def file which is not a module definition file -

my company uses .def store symbol definitions (ascii text file). using cmake create visual studio solutions. have def files visible visual studio easier editing. when create library that: set(a_src a.cpp a.def) add_library(a shared ${a_src}) visual studio solution file browser show a.cpp . a.def present in vcxproj file, that: <moduledefinitionfile>a.def</moduledefinitionfile> , , not appear in solution file browser. is there way tell cmake or visual def file not module definition file , should treated regular text file? you can change property of .def file after adding it: set(a_src a.cpp a.def) add_library(a shared ${a_src}) set_source_files_properties(a.def properties header_file_only true) this makes file visible in vs (tested on vs2013) for reference: https://cmake.org/bug/view.php?id=7835

html - How to apply padding to every line in multi-line text? -

i have background color applied <span> tag, there left , right padding set on it. problem is: padding applied left (beginning) , right (ending) of <span> , not left (beginning) , right (ending) of each line when text wrapped on several lines. how can apply left , right padding middle lines? h1 { font-weight: 800; font-size: 5em; line-height: 1.35em; margin-bottom: 40px; color: #fff; } h1 span { background-color: rgba(0, 0, 0, 0.5); padding: 0 20px; } <h1><span>the quick brown fox jumps on lazy dog.</span></h1> you use box-decoration-break property value of clone . box-decoration-break: clone; each box fragment rendered independently specified border, padding , margin wrapping each fragment. border-radius, border-image , box-shadow, applied each fragment independently. background drawn independently in each fragment means background image background-repeat: no-repeat may repeated multipl...

android - Background of List items is stretching more than height? -

i have listview custom adapter (tile) design. should work fine thing til (listview item background) stretches despite me giving layout_height fixed value. here's code: this xml custom tile. notice 85dp fixed height. background drawable should not stretch beyond hight? <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="85dp" android:background="@drawable/tile_job" > <textview android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="9dp" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="13dp" android:text="title...

php - Changing language flag and text on click -

Image
back again new question. i'm still working on projects website, , i'm kind of stuck simple option. im trying show language flag @ menu current language. flag, no text (maybe we'll want later though). right now, menu works this: user_box.php <?php trace(__file__,'begin'); ?> <div id="userbox"> <ul id="account_more_menu"> <?php if(isset($_userbox_projects) && is_array($_userbox_projects) && count($_userbox_projects)) { ?> <li><a href="<?php echo get_url('dashboard', 'my_projects') ?>"><?php echo lang('my projects') ?></a> <ul> <?php if (logged_user()->canmanageprojects()) { ?> <li><a href="<?php echo get_url('project', 'add') ?>"><?php echo lang('add project') ?></a></li> <li><a href="<?php echo ...

64bit - Getting the new Squeak 5 to run on 64 bit Linux -

in short: how squeak 5 run on x64 linux? dont care whether executable 32 or 64 bit long runs , opens squeak 5 image. here tried: when try run executables squeak 5 package get: running 32-bit squeak on 64-bit system. install-libs32 may install them - tried that. wasn't found. then went looking 64 bit executable. there squeak 4 can't open squeak 5 images. looking through squeak 5 package: the shell scripts squeak.sh in both these directories: squeak-5.0-all-in-one/ squeak-5.0-all-in-one/squeak-5.0-all-in-one.app/contents/linuxandwindows/ both return error: /usr/bin/ldd didn't produce output , system 64 bit. may need (re)install 32-bit libraries. there misleading files named squeak (no .sh) in these directories: squeak-5.0-all-in-one/squeak-5.0-all-in-one.app/contents/linuxandwindows/linux-i686 squeak-5.0-all-in-one/squeak-5.0-all-in-one.app/contents/linuxandwindows/linux-i686/bin they not executable, more shell scripts. there squeak fi...

java - sorting by first character -

the question @ hand each policy no. string of 9 characters of indicates type of insurance policy b building policy c contents policy l life policy v car policy each of remaining 8 characters of policy number decimal digit. i have tried using charat told me there better way public string getpolicyno(string initpolicyno) { /** * access method find first character of policy * determine type of policy is. */ string b = "b"; string c = "c"; string l = "l"; string v = "v"; char c1 = b.charat(0); char c2 = c.charat(0); char c3 = l.charat(0); char c4 = v.charat(0); if (c1 == 0) { system.out.println("its building" + c1); return initpolicyno; } else { if (c2 == 0) { system.out.println("its content"); return initpolicyno; } else { if (c3 == 0) { system.out.println("its li...

angularjs - How to add ellipsis with count of remaining item using angular? -

how can achieve ellipsis count of element not included in area. example i have array of name apple,mango,straw,litchi,orange,grapes my container 100px wide can carry few name depending on width. result should come as apple,mango,straw... +3 more or apple,mango... + 4 more if(width less) how achieve thing angular. var ellipsiscreator = function(array) { var arraysize = [], size = 0, stopcounter = 0; scope.tooltiptext = null; scope.visibletext = null; scope.remaining = 0; for(var i=0;i<array.length;i++){ var e=document.createelement('span'); document.body.appendchild(e); e.style.fontsize = scope.fontsize+'px'; e.setattribute("class", ...

knockout.js - ASP.Net WebAPI ActionName Route Not Found -

i trying create webapi controller multiple commands using actionname method. did on project, have been having problems latest project , cannot see understand why knockout view model ajax call cannot find specific uri. webapiconfig.cs: config.routes.maphttproute( name: "defaultapi", routetemplate: "api/{controller}/{action}/{id}", defaults: new { id = routeparameter.optional } ); controller: // api/lot [actionname("default")] public ienumerable<dataobject> get() { //... } // api/lot/specific/5 [actionname("specific")] public ienumerable<dataobject> get(int? data) { //... } // api/lot/5 public string get(int id) { return "value"; } my default action works perfect specific action continues have error when attempt call view-model: "failed load resource: server responded status of 404...

javascript - Navbar with fixed position staying on the top while header disappear -

i want make navbar fixed position. @ top of page navbar should under header , after scrolling down when header no longer visible navbar should @ top of page. how can that? when try after scrolling down between navbar , top of page still height of header(even though no longer visible). here css: header{ background-color: red; width: 100%; height: 100px; } nav{ position: fixed; float:left; height: 100px; width: 100px; margin-left: 10px; margin-right: 50px; margin-top:50px; background-color: green; } main{ background-color: blue; height: 1500px; margin-left:15%; margin-right:5%; margin-top:50px; } and jfiddle: https://jsfiddle.net/pg2kwk5e/ you can add class nav element javascript after scrolling amount. i've used jquery it's faster , easier show in action. example i'm adding class .fixedtop nav after window scrolls more 150 pixels, class has top:0;margin0; move absolute positioned element top , remove margin se...

My C program outputs undesired array values -

i've been tasked code program processes simple 1d array return element values, compiler has been behaving strangely; outputting more values have array elements.. it's not being compliant 1 of statements (one prints new line character every 8 elements) , not assigning largest value variable. think other 2 problems go away once first problem fixed, however. here brief: design, code , test program that: fills 20 element array (marks) random numbers between 0 , 100. prints numbers out 8 line prints out biggest number, smallest number , average of numbers and here code: #include <stdio.h> #include <stdlib.h> #include <time.h> int main(){ srand(time(null)); int marks[20]; int = 0; int sum = 0; int min; int max; for(i;i<=sizeof(marks);i ++){ marks[i] = rand() % 100; sum += marks[i]; if(i % 8 == 0){ printf("\n"); } printf("%d ", marks[i]); ...

Sunspot automaticly escape special characters -

using sunspot , solr 4+ there way automatically escape special characters. for example in simple fulltext search like: post.search fulltext term end if term contains of special chars ( http://lucene.apache.org/core/4_0_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#regexp_searches ) should auto escaped. inside initializers file add following code re_escape_solr = /([-+!\(\)\{\}\[\]^"~*?:\\]|&&|\|\|)/ class string def escape_solr gsub(re_escape_solr) { |e| "\\#{e}" } end end and whenever searching can call post.search fulltext term.escape_solr end

java - JADE: Scheduling behaviours -

i teaching myself jade , wondering whether there easy way schedule behaviours in such way 1 agent behaviour won't executed until other agents have finished behaviour cycles? for example, assuming have set of behaviours (a, b, c) add each agent, not want of other behaviours (b,c) execute until agents have completed behaviour a. in advance. you can orchestrate such behavior exchanging messages among agents. here paper more sophisticated protocol can avoid deadlocks in mas: http://www.db-thueringen.de/servlets/derivateservlet/derivate-19681/esm2009_s337-341.pdf

ASP.NET 5 / MVC 6 /C#: Close File Path after usage -

i've got problem closing temporary file. in method i'm, generating ics file, write text in , send using mimemail. problem don't know how close path can access delete after mail send. , mimemail not provide solution message.dispose() or message.close(). here code: public void sendemailwithical(string toemailaddress, string subject, string textbody) { var message = new mimemessage(); message.from.add( new mailboxaddress("chronicus dev", this.username)); message.to.add(new mailboxaddress(toemailaddress.trim(), toemailaddress.tostring())); message.subject = subject; calenderitems icalender = new calenderitems(); icalender.generateevent("neuer kalendereintrag"); var termin = icalender.ical; string path = "tempicsfiles/file.ics"; if (file.exists(path)) { file.delete(path); } { // create file , write ...

Javascript working on local, not working online -

i've uploaded website , wrong. have smooth scrolling when clicking in navigation menù, , worked on local (i used brackets), it's not. also, when access site phone, menù doesn't open. can please? site http://www.chiarabonsignore.com your problem on website forgot upload following file: http://www.chiarabonsignore.com/js/bootstrap.min.js because following error: "networkerror: 404 not found - http://www.chiarabonsignore.com/js/bootstrap.min.js " i'd suggest checking this link out . hope helps!

CKAN/Solr on Ubuntu: JSP not configured -

i trying set ckan on ubuntu 14.04.03 (desktop). i've been following these instructions: http://docs.ckan.org/en/latest/maintaining/installing/install-from-source.html have gotten stuck on portion need check , see if solr working. jetty installation appears working fine, "welcome jetty 6 on debian" page. however, if navigation localhost url: localhost:8983/solr, following error message: http error 500 problem accessing /solr/index.jsp. reason: jsp support not configured. i have done bunch of research on topic, including questions here , here , have not been able solve problem these solutions. how configure jsp support? i've made sure edit java_home setting in /etc/default/jetty points java installation, doesn't seem have effect on jsp support. best re-do installation process? thanks assistance can provide!

r - Reordering a list by element in list and remove specified rows in list -

continuation question: add row in r dataframe unique factor in column showing percent change month testing <- data.frame( month = c("mtd: 12", "mtd: 12", "mtd: 11", "mtd: 12", "mtd: 12", "mtd: 12"), year = c(2012, 2013, 2014, 2015, 2013, 2014), client = c("a.", "a.", "a.", "b.", "b.", "b."), revenue = c(320, 205, 166l, 152, 150, 138), col1 = c(651, 485, 533, 3932, 171, 436), col2 = c(478, 335, 305, 238, 115, 251), col3 = c(73, 69, 57, 6, 67, 57), col4 = c(6.7, 6.1, 5.5, 6.4, 13.1, 5.5) ) # subset month=12 rows test12 <- testing[testing$month=="mtd: 12", ] test12 <- test12[order(test12$client, test12$year), ] # define function calculate percent change pctchange <- function(x) { l <- length(x) c(na, 100 * (x[-1] - x[-l]) / x[-l]) } # calculate percent change columns, client change <- apply(test12[, c("...

.htaccess - htaccess 301 redirect not working for new subdomain site -

i'm moving site wanted test page , redirect in htaccess file: i wanted redirect http://www.martinspencephotography.co.uk/blog/yes/mini-photo-series-minimalism-gallows-hill-outside-cloughmills to http://landscape.martinspencephotography.co.uk/minimalism-at-gallows-hill/ using following in .htaccess file: redirect 301 /blog/yes/mini-photo-series-minimalism-gallows-hill-outside-cloughmill http://landscape.martinspencephotography.co.uk/minimalism-at-gallows-hill it didn't works there reason why might not work? try rewriterule your_page.html http://your.url.fr/yournewpage.html [r=301] and about http://www.martinspencephotography.co.uk/blog/yes/mini-photo-series-minimalism-gallows-hill-outside-cloughmills http://landscape.martinspencephotography.co.uk/minimalism-at-gallows-hill/ [r=301] so answer use drupal node...

Java JSON deserialize String with property names as field names -

i receiving api json that: { "channel":"masta", "starttime":1427673600000, "endtime":1427760000000, "totaluniques":1, "totalviewtime":1927, "totalviews":13, "totalcountries":1, "countries":{ "us":{ "uniques":1, "views":13, "viewtime":1927 } } } now want deserialize class, class(stats) have fields channel, starttime , on. how handle countries property? i thought making class countries not sure cause it's have "us" property name. not "country": "us". , what's more has own parameters. how deserialize it? mostly using objectmapper object.readvalue(jsonstring) don't know how handle 'countries'. in example 1 country 'us' can more. declare country class: public class country { private int uniques; private int views; private int v...

html - JavaScript: Problems in Snakes and Ladders Game -

i new javascript. making snakes , ladders game. facing problems on code. first can not store current position of player can count next destination. the dice starts 1 @ beginning of game , causes player start second cell. the big snake , ladder divs displayed onto board not auto fit size of board. here code wrote far snakes , ladder game var gameboard = { createboard: function(dimension, mount) { var mount = document.queryselector(mount); if (!dimension || isnan(dimension) || !parseint(dimension, 10)) { return false; } else { dimension = typeof dimension === 'string' ? parseint(dimension, 10) : dimension; var table = document.createelement('table'), row = document.createelement('tr'), cell = document.createelement('td'), rowclone, cellclone; var output; (var r = 0; r < dimension; r++) { rowclone = row.clonenode(true); table.appen...

Building with Ant in Eclipse - javac not recognizing lambda expression (Java 1.8) -

i trying build existing project using ant in eclipse. problem javac not recognize use of lambda expression ( error: illegal start of expression ) in 1 of files, , build fails during compile phase of ant. within eclipse, i've ensured java compiler compliance level set 1.8 , java 8 in java build path . i've ensured path , java_home , , jre_home point java 8 directory (in path points /bin directory). for giggles, compile section of build.xml file is: <target name="compile" depends="setup"> <javac destdir="${base}/${build.dir}" srcdir="${base}/${src.dir}" deprecation="true" verbose="false" includeantruntime="false"> <classpath refid="libs" /> </javac> </target> i'm not sure next. i've resorted restarting eclipse hoping magic happen. suggestions or welcome! in advance. ad...

Fastly versus my own hosted Varnish -

what benefits of using fastly versus having own self-hosted varnish? there additional benefits , features fastly provides regular varnish not, or fastly managed varnish in same way cloudamqp hosted , managed rabbitmq? i stumbled accross question, know asked while ago i'm going try , answer regardless. you correct in assuming fastly manages varnish instances you, don't have deal manually managing servers. different concept cloudamqp however; cloudamqp managed rabbitmq system lives in specific datacenter, perhaps multi-az enabled failover purposes. fastly full blown content delivery network means have machines running varnish on world increase user's experience because of lower latency. example if australian user visits website retrieving cached content via fastly's australian machines, whereas if connect own varnish instance he'd have connect instance in u.s. introduce lot more latency. on top of wouldn't improve speed, reliability. single varni...

How to random java string array , that each array will be true random? -

this question has answer here: random shuffling of array 18 answers i have java string array looks : string [] cards = {"c1","c2","c3", , , , , , ,, , "c45"}; so have there 45 elements , rendom them each time : int[] cards2 = arrays.copyof(cards , cards .length); random(cards2); how should random function ? you can use collections.shuffle(arrays.aslist(cards));

asp.net - Produce different html view in each cycle -

please this. how can produce different html view in each cycle. can mvc can not asp.net web form. can repeater( or listview ) , multiview? thanks everything. <div id="movieresults"> @foreach (var movie in homecontroller.movies) { if(condition) { block of html1 } else if(condition) { block of html2 } else if(condition) { block of html3 } } </div> you can use usercontrol ucontrol.ascx <%@ control language="c#" classname="ucontrol" %> <div>control content</div> ucontrolview.aspx <%@ page language="c#" autoeventwireup="true"%> <%@ register tagprefix="uc" tagname="mycustomcontrol" src="~/controls/ucontrol.ascx" %> <html> <body> <form runat="server"> <uc:mycustomcontrol id="mypartialvie...

otrs - AgentTicketQueue to display locked tickets also by default? -

Image
we 2 people coordinating work of 14 first , second line support employees. able dive specific queue "printers" , see going on in there. if use agentticketqueue view open tickets, need see locked tickets too, able see our people working on , if needs reprioritized. i know can click "all tickets" button when have selected queue, , work. problem queues no unlocked tickets not displayed @ in agentticketqueue view. quite common occurence here because tickets gets assigned (locked) quickly, can take time solve , close. there's agentticketstatusview includes tickets queues in jumble , not useful in our situation 500+ tickets in progress. is there setting or hack enable mode of operation? ideally separate menu item, because agents want current otrs functionality pick unlocked tickets from. the straightforward way ( without additional coding or hacking ) use search filter templates. press on looking glass icon (search) on top menu of otrs. set se...

unnest - "Unnesting" a dataframe in R -

i have following data.frame : df <- data.frame(id=c(1,2,3), first.date=as.date(c("2014-01-01", "2014-03-01", "2014-06-01")), second.date=as.date(c("2015-01-01", "2015-03-01", "2015-06-1")), third.date=as.date(c("2016-01-01", "2017-03-01", "2018-06-1")), fourth.date=as.date(c("2017-01-01", "2018-03-01", "2019-06-1"))) > df id first.date second.date third.date fourth.date 1 1 2014-01-01 2015-01-01 2016-01-01 2017-01-01 2 2 2014-03-01 2015-03-01 2017-03-01 2018-03-01 3 3 2014-06-01 2015-06-01 2018-06-01 2019-06-01 each row represents 3 timespans; i.e. time spans between first.date , second.date , second.date , third.date , , third.date , fourth.date respectively. i to, in lack of better word, unnest dataframe obtain instead: id startdate enddate 1 1 2014-01-01 ...

multithreading - Parallel solving in Minizinc from the command line -

the minizinc ide has parallel solver option ("number of threads") in config section. when compiling commandline, however, mzn2fzn binary doesn't seem support parallel option. possible solve in parallel commandline-compiled file? you can either use minizinc via integrated development environment ( ide ) or via commandline call. using ide 2.0.8 in ide , use configuration tab specify number of threads used searching/solving. depending on selected backend, may end error message, multi-threading not supported respective backend. via commandline, can either call compiler , backend separately, or can use minizinc.exe act umbrella tool call them sequentially. tools have commandline option --help explain parameters. minizinc.exe accepts -p or --parallel run backend in multi-threading mode, provided supported.

sqlite3 - column delta values -

i planning store query data in sqlite3 database. i have these fields in sqlite3 unix_epoch, cumulative_query_rate 1452128581, 150 1452128582, 190 1452128583, 220 1452128584, 270 i want queries-per-second column below: qps 0 40 30 50 how do in sqlite3. you have subtract value of previous second: select unix_epoch, (select t1.cumulative_query_rate - t2.cumulative_query_rate supersecrettablename t2 t1.unix_epoch - 1 = t2.unix_epoch ) qps supersecrettablename t1;

Scope (root node, context) of XSLT "key" Element -

i have xslt key defined. need access key within for-each loop, loop processing node-set outside scope of key defined. snippet, i've marked 2 lines, 1 works , 1 not: <xsl:value-of select="key('name', 'use')"/> <!-- works --> <xsl:for-each select="$outofscopenodeset"> <xsl:value-of select="key('name', 'use')"/> <!-- not work --> </xsl:for-each> is there way access key within for-each loop? xslt 1.0, msxsl engine. (i not think of reasonable way provide full working example this. i'm not sure of correct terminology, such "scope" - perhaps if knew correct terminology i'd able find answer already. if question not clear enough please let me know , i'll try edit better shape.) in xslt 1.0, keys not work across documents. seems $outofscopenodeset contains node-set root node different root node of xml document being processed (probably created ex...

openfiledialog - Method for "adding" new data to current open file C# -

i writing program have 2 listboxes same data 1 listbox items update student name , total score , other student name , each individual judge score next student name. going far stuck... have 2 methods save() , saveas() save() automatically writes data "formdata.bin" , saveas() lets user enter own file name. is possible re-write save() method when click save saves current data file open in ms word when typing in document , click save add new typed data current file. here save() method wrote. public void saveentry() { int itemscount = math.min(lstbxstudents.items.count, lstbxstudentscore.items.count); savefiledialog1.initialdirectory = application.startuppath; savefiledialog1.filename = "formdata.bin"; { try { using (filestream fs = new filestream(savefiledialog1.filename, filemode.create)) using (binarywriter save = new binarywriter(fs)) { ...

python - Creating multiple sql databases of the same structure using Peewee -

i looking create 26 separate sql databases, each same structure. (i.e. 1 each letter of alphabet), ideally can access dictionary or similar [i.e. access database corresponding letter a database["a"] ]. i have following code, generates 1 sql database (in case letter a) using peewee. from peewee import * database_location_a = "c:\\database\\a.db" data_sql_a= sqlitedatabase(database_location_a, threadlocals=true, pragmas=(("synchronous", "off"),)) class basemodel(model): class meta: database = data_sql_a class main_table(basemodel): file_name = charfield(primary_key = true) year = charfield() data_sql_a.connect() data_sql_a.create_tables([main_table]) there parts of code can loop on (e.g. can create dictionary of file locations). however, stuck given location coded class basemodel , how loop on [i.e. need 26 separate classes, , if so, can create without needing copy/paste class 26 times]? , similarly...