Posts

Showing posts from March, 2015

c++ - Boost Multiarray of std::vector -

i'm new boost (and stackoverflow) , want use multiarray of vectors. have done way: typedef boost::multi_array<std::vector<vector3_t>, 2> array_type; array_type* mimage; int mresolution = 1000; mimage = new array_type (boost::extents[mresolution][mresolution]); //works mimage[0][0].origin()->push_back(vector3_t()); //error: abort() mimage[1][1].origin()->push_back(vector3_t()); //error: abort() mimage[500][440].origin()->push_back(vector3_t()); on internet can find examples of multiarray use int,doule , on. possible use std::vector in mutliarray ? know use 3d multiarray, prefer vectors elemet. boost.multiarray supports std::vector elements. in general, boost.multiarray perform concept checking @ compile-time. thus, if code compiles complete type, should supported. with mimage[0][0].origin() : mimage[0][0] returns reference std::vector<vector3_t> . origin() not member function on std::vector<vector3_t> , resulting in erro

java - How to convert Json string with key-value pair into string with only value -

i converted pojo data json string way, gson gson = new gsonbuilder().disablehtmlescaping().create(); string json=gson.tojson(user); i got json string not format need, got json = {"userid":300,"username":"asd","password":"s","enabled":1} so, want convert json string key-value pair below , {"userid":300,"username":"asd","password":"s","enabled":1} into json string value (without key) below [300,"asd","s",1] you whack properties of user list<object> , json that. this mean gson made json array out of list , want. as doesn't seem make sense use case have bit of hardcoding - don't think gson can you: final list<object> props = new linkedlist<>(); props.add(user.getid()); props.add(user.getusername()); //etc final string json=gson.tojson(props);

android - How to write Json Parser class from this .json file -

i want media player (android) should play songs urls . , using json file update playlist file daily. please me got stuck on thanks. { "json": { "songs": [ { "song": "song name ", "artist": "sonjay singh", "mp3": "http://c2lo.reverbnation.com/audio_player/download_song_direct/9140921.mp3" }, { "song": "song name", "artist": "aritist", "mp3": "mp3_url" }, { "song": "song name", "artist": "aritist", "mp3": "mp3_url" } ] } } i made class still finding difficult how use it.. helping me. public class json{ private list songs; public list getsongs(

android - Is there any transition intent listener? -

is possible handle animation of intent transition? actually possible in project click on button (which opens new intent) , fast click - code in activity second executed still in on first screen. wait till new screen shows , execute code. so far trying handlers , async tasks wasn't move. not able dig in xml animation code, it's big. playgoround in 2 activities. so far found link http://developer.android.com/reference/android/animation/layouttransition.transitionlistener.html far don't know how use it..

javascript - any same way in js as I have in css? -

i trying find same thing, have not found yet. ( been searching hours. ) i got hovered tie gets big square. (see link see ment: http://rdv-design.com/stageverslag2/home.html just different want when hover tie , square comes out, square not disappear when put mouse on div that's above it. when put mouse outside box of hovered tie (square), want disappear. anyone has idea? thanks! in showdiv.js , you've got this: $(function() { $('.vierkant').hover( function() { $('#tekst').show(); } else { $('#tekst').hide(); } ); }); this isn't valid, else not part of if . think want is: $('.vierkant').hover(function() { $('#tekst').show(); }, function() { $('#tekst').hide(); }); this call .hover() uses 2 functions, 1 when mouse enters (show) , 1 when mouse leaves (hide). once done, hover event handled accordingly. see also: jquery

zend framework - add multi tables in from() zend_db_select -

i have select multi tables using zend_db_select sql : select t1.id,t2.ids, t3.uid table1 t1,table2 t2, table3 t3 this code used : $subquery = $this->getdbtable ()->select ()->setintegritycheck ( false ) ->from(array('t1'=>'table1','t2'=>'table2','t3'=>'table3'),array('t1.id','t2.ids','t3.uid')) ->query() ->fetchall(); so have message error t2.ids not in column list because zend_db_select take first table any solution resolve problème ? thaks you can use cross join with: $subquery = $this->getdbtable ()->select ()->setintegritycheck ( false ) ->from(array('t1'=>'table1'),array('t1.id')) ->joincross(array('t2'=>'table2'),array('t2.ids')) ->joincross(array('t3'=>'table3'),array('t3.uid')) ->query() ->fetchall();

Extract distinct Fields values from mongoDB collection -

i'm quite new mongodb , i'm stuck simple (or not) problem: i have collection of tagged products this: { "_id": "1", "tags": { "shape" : [ "shape1","shape2" ], "color": [ "col1","col2" ] }, { "_id": "2", "tags": { "shape" : [ "shape3","shape4" ], "color": [ "col3","col4" ] }, { "_id": "3", "tags": { "othercategory" : [ "value1" ], "color": [ "col5","col6" ] } i want select distinct category collection , have results: [ "shape", "othercategory" ] how can achieve ? seems option find tags , parse manualy in java client...seems bad ;-) i query mongodb java spring client. thanks help. ok ended refactoring model : looks it's not easy make queries on documents contents without do

Log analysis script in shell -

i'm newbie in scripting , need help. have log file, i'm cleaned out. looks (time, duration(in millisec), action): 2012-04-28 00:00:00;277.406; 2012-04-28 00:00:00;299.680; 2012-04-28 00:00:00;282.338; 2012-02-28 00:00:00;272.241; i need make script use duration data , count action. first - need make easier parse different fields. simple way change semicolon space using tr ";" " " <logfile|awkscript second, need create table of low , high values. i'm using associative array index name of column. in begin section. you need count when value within low , high values. in middle section. in end section, print out values. use 2 similar printf format strings make sure headers , values line nicely: #!/usr/bin/awk -f begin { low["<1ms"]=0;high["<1ms"]=1 low["1-10ms"]=1;high["1-10ms"]=10 low["10-100ms"]=10;high["10-100ms"]=100 low["100-500ms"

math - matrix norm that is invariant through a change of basis -

i looking matrix norms invariant through change of basis. know frobenius norm, satisfy condition can expressed function of eigenvalues of matrix only. there other norms that? if so, geometrical interpretation? if on wikipedia @ matrix norms you'll find variety of answers, including frobenius norm.

linux - host many domain to the same server -

i have domain: site 1: /var/www/portail1 with conf: /etc/httpd/conf.d what want add domain same server: site 2: /var/www/portail2 but question here site 1 call conf.d default, , need second conf.d site 2, how can tell site 2 search conf ( example /etc/httpd/conf2.d)? by default, there should include directive in main apache configuration: either httpd.conf or apache2.conf. in ubuntu apache2.conf, that: # include generic snippets of statements include conf.d/ # include virtual host configurations: include sites-enabled/ so, if add conf file inside conf.d/ or sites-enabled/ automatically included , read apache during start.

objective c - 3 text boxes and a calculate button -

i have 3 text boxes , calculate button, how can tell button witch text box selected , convert number other text boxes, have tagged text boxes 1, 2 , 3, new , green in programming great. code - (ibaction)calculate:(id)sender { nsnumberformatter *numberformatter = [[nsnumberformatter alloc] init]; float = [[numberformatter numberfromstring:_barrels.text] floatvalue]; float b = [[numberformatter numberfromstring:_gallons.text] floatvalue]; float c = [[numberformatter numberfromstring:_liters.text] floatvalue]; _barrels.text = [[nsstring alloc]initwithformat:@"% .2f", a]; _gallons.text = [[nsstring alloc]initwithformat:@"% .2f", * 42]; _liters.text = [[nsstring alloc]initwithformat:@"% .2f", * 159]; _barrels.text = [[nsstring alloc]initwithformat:@"% .2f", b * .0238]; _gallons.text = [[nsstring alloc]initwithformat:@"% .2f", b]; _liters.text = [[nsstring alloc]initwithformat:@"% .2f&qu

ios - UIDocumentInteractionController doesn't open the app (didEndSendingToApplication: never called) -

i have uidocumentinteractioncontroller instance (that does have strong reference in class, aware of memory issues it) , want send photo file instagram. i saved file using ig extension (tried igo well) , presenting controller. instagram displayed on list. tap instagram, , nothing happens. nsurl *imagefile = [nsurl fileurlwithpath:path]; interactioncontroller = [uidocumentinteractioncontroller interactioncontrollerwithurl:imagefile]; interactioncontroller.uti = @"com.instagram.photo"; interactioncontroller.annotation = [nsdictionary dictionarywithobject:@"my caption" forkey:@"instagramcaption"]; interactioncontroller.delegate = self; [interactioncontroller presentopeninmenufromrect:self.view.frame inview:self.view animated:yes]; to investigate further, i've set calling class delegate , implemented willbeginsendingtoapplication: , didendsendingtoapplication: methods. interestingly, i've realized willbeginsendingtoapplication: called,

.net - Change DataGridViewCell BG Color Upon Creation -

currently there column in grid changes background colors when grid sort event called. bg color changes depending upon integer value within cell. right loop , has go through each row , locate particular cell , check value. unless must execute bit of code each time rows sorted otherwise go default color. i'm looking way write code permanently set background color of these cells upon creation when grid first loaded doesn't have set each time column header clicked , data sorted. solution datagridview.cellformating event handler.

Xtext: referencing existing java packages and methods -

i developed dsl use standard java code. in dsl can write things this: package: packagename; method: void testmethod (int, double); what want do, user of dsl can write package names , method signatures exist in java project. example: when project consists of 1 package e.g. “testpackage”, user of dsl should able write: package: testpackage the name “testpackage” should suggested code completor. same shall work methods. is possible? , how can xtext? i've not used (yet), take @ relevant xtext documentation on this. also, i'd through " 7 languages ", find 1 want (which think you'll find), , study source.

amazon web services - AWS Node.js API error -

i'm using aws node.js api ( aws-sdk ) version 1.0.0 on node version 0.11.2. error constructing api object: var aws = require('aws-sdk'); aws.config.update({region: 'eu-west-1'}); var s3 = aws.s3(); the error is: /.../node_modules/aws-sdk/lib/service.js:25 var serviceclass = this.loadserviceclass(config || {}); ^ typeerror: object #<object> has no method 'loadserviceclass' @ object.service (/.../node_modules/aws-sdk/lib/service.js:25:29) @ object.features.constructor [as s3] (/.../node_modules/aws-sdk/lib/util.js:405:24) @ readstream.<anonymous> (/.../server.js:92:22) @ readstream.eventemitter.emit (events.js:97:17) @ fs.js:1492:10 @ object.oncomplete (fs.js:94:15) i same error node 0.8.23, 0.9.12 , 0.10.5 too. i can't find reference error anywhere, doesn't happen else! doing wrong? you have create new object s3 via new : var aws = require('aws-sdk'); aws.conf

java - Failed to parse int 3 in base 3 -

strangest thing. have line int = integer.parseint("3",3); but everytime run it, numberformatexception.forinputstring. why? simple base conversion. special int 3 breaks conversion? if want parse base-10 base-n string can use : system.out.println(integer.tostring(3, 2)); // print 11 -> string data type code above parse 3 in base 10 (integer) binary (base-2) string . following code should parse base-2 string base-10 integer value : system.out.println(integer.parseint("11", 2)); // print 3 -> base-10 integer code above parse 11 binary base-10 integer. code have error string format, base-3 string consist 0 , 1 , 2 . please note difference how use both method.

java - Converting 1 dimensional array to 2 dimensional array -

i request converting code 2 dimensional array. i'm not asking fix code, starting point or since arrays weak point in coding. here code: import java.io.*; import java.util.*; public class rubix { public static void main(string[] args) { string[] 1 = {"red","red","red","red","red","red","red","red","red"}; string[] 2 = {"blue","blue","blue","blue","blue","blue","blue","blue","blue"}; string[] 3 = {"yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow"}; string[] 4 = {"green","green","green","green","green","green","green","green","green"}; string[] 5

sql - Select two consecutive records by date, records from the database, with a maximum difference of dates -

i want select 2 consecutive records date, records database, maximum difference in consecutive dates. there table name date abc 1242 bcd 1246 bsd 1247 bse 1249 the result of query should be: abc 1242 bcd 1246 my query is: select t1.name, t2.name, max(t2.date - t1.date) temp t1 join temp t2 on t1.date < t2.date not exists ( select t3.date temp t3 t3.date > t1.date , t3.date < t2.date ) is best solution? thanks in advance declare @a table(name varchar(10), date int) insert @a select 'abc', 1242 union select 'bcd', 1246 union select 'bsd', 1280 union select 'bse', 1242 select row_number() on (order name) 'rownumber',* #temp @a select top 1 * #tbl ( select a1.name n1,a2.name n2,abs(a2.date-a1.date) diff #temp a1 join #temp a2 on a2.rownumber-1 = a1.rownumber )as tbl order diff desc select * @a name =(select n1 #tbl) or name =(select n2 #tbl) drop table #temp drop

c# - Is it possible to get a reference to MyList<Object> if the listname is a string "myList" -

i have lists of type observablecollection<sampleobject> end letter of alphabet: lista, listb, listc... want make loop runs through alphabet , @ every letter should add item current list. example: for (char = 'a'; < 'z'; i++) { string name = "list" + i; name.add(.....); } the "name" in example should list want add item. you want dictionary<char, observablecollection<sampleobject>> , have different collection each char .

sass - Weird misalignment in my Susy layout -

Image
the elements set susy span-column() mixin to, not obey it. misaligned ever slightly. how achieve perfect alignment of html elements? screenshot of full website misalignment detail : <header> , <nav> misalignment detail : <section class="main"> misalignment here sass code @import compass @import susy @import normalize /* susy settings */ $total-columns : 5 $column-width : 4em $gutter-width : 1em $grid-padding : $gutter-width $desktop : 12 /* susy-grid-background override draw out horizontal lines */ =susy-grid-background +grid-background($total-columns, $column-width, $gutter-width, $base-line-height, $gutter-width, $force-fluid: true) $base-font-size: 18px $base-line-height: 30px +establish-baseline ul background-color: rgba(1, 0, 50, 0.1) li background: rgba(200,50,0,.2) text-align: right background: rgba(0,220,0,.2) display: block h1 +adjust-font-size-

android - Parse Json text as question mark -

i'm using json getting text sql database. there many unicode formats utf-8 saving data in database. i used utf-8 saving text. text not english. persian or arabic. json shows text ???? . think problem json parser. please help. public class jsonparser { static inputstream = null; static jsonobject jobj = null; static string json = ""; // constructor public jsonparser() { } // function json url // making http post or method public jsonobject makehttprequest(string url, string method, list < namevaluepair > params) { // making http request try { // check request method if (method == "post") { // request method post // defaulthttpclient defaulthttpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(url); httppost.setent

ruby on rails 3 - Amazon EC2 timeout after 30 seconds -

i deployed ror3 application on amazon ec2 using rubber. i have slow request takes 1 minute, dies after 30 seconds error: 504 gateway time-out server didn't respond in time. does know how increase timeout time? long running requests not idea can see. webservers timeout after 30 seconds of no response fcgi application. you need @ fcgi timeout vars webserver application deployment using.

mapping - Eager loading an optional one-to-one with NHibernate -

consider following simplified domain: public class movie { public virtual int id { get; set; } public virtual moviedetail moviedetail { get; set; } } public class moviedetail { public virtual int id { get; set; } public virtual movie movie { get; set; } } a moviedetail cannot exist without movie , movie exist without moviedetail (i.e. have no details it). our database has separate table movie columns id , , separate table moviedetail columns id , movieid . there foreign key moviedetail.movieid movie.id . we've got mapped in nhibernate, when getting collection of movie instances, want left outer join moviedetail . if not, have n+1 problem when iterating on movie instances. case now: there separate query every call movie.moviedetail property. i've tried one-to-one mapping, seems case when have both instances. in our case, don't have moviedetail . also, don't share same primary key. i've researched formula's, require me m

winapi - How many requests does IcmpSendEcho2 send? -

icmpsendecho2 documentation says: the replybuffer contains icmp echo responses , if any. for icmp, if 1 request sent, wouldn't 0 or 1 responses expected? if that's case, mean icmpsendecho2 can send multiple requests since can receive multiple responses? , if so, there way find out how many requests sent? the goal of try , packet loss %, knowing how many requests sent needs known. icmpsendecho2() sends 1 request, can generate multiple responses. output array of responses, have make sure array large enough receive of responses.

datatables - Twitter Bootstrap Responsive - Show Table Column only on Desktop -

Image
i'm using datatables.net + twitter bootstrap , responsive layout, i'm trying hide columns of table using class "visible-desktop" thats shows columns in big sizes seems not work, hides if resize windows desktop width columns hidden start showing stacked, seems css display class problem, because inherits type of display parent: .visible-desktop { display: inherit!important; } if manipulate .visible-desktop { display: table-cell!important; } works well... there workaround this? or have write own class table column hiding? available classes .visible , .hidden . use single or combination of available classes toggling content across viewport breakpoints. from bootstrap section here http://getbootstrap.com/css/#responsive-utilities-classes

sql - Pivoting data in MS Access -

i have query i've created pull student ids , meal items have taken on month long period. count numbers of each item (breakfast, lunch, snack) taken student on course of month. it appears there's data access handle in pivot table report, hoping there sql query run instead. here's current query i've created: select april2013.sid, menuitems.mealtype apr2013meal april2013 left join menuitems on menuitems.item=april2013.item; current output: +-----+-----------+ | sid | meal | +-----+-----------+ | 001 | lunch | | 002 | lunch | | 003 | breakfast | | 004 | snack | | 005 | lunch | | 006 | lunch | | 001 | breakfast | | 003 | snack | | 004 | breakfast | +-----+-----------+ here's how i'd look: +-----+-----------+-------+---------+ | sid | breakfast | lunch | snack | +-----+-----------+-------+---------+ | 001 | 3 | 10 | 1 | | 002 | 4 | 8 | 10 | | 003 |

c++ - Groupbox alignment of title in qt doesn`t work. Why? -

i created simple mainwindow form in qt 4.8.4 designer, in preview title placed in top left corner should be, when use form in simple program writen in eclipse qt plugin, title placed straight @ top top center not right. when use ui.groupbox->setalignment(qt::alignright); or left before show(), nothing happen title stays @ center. may cause this? program minimalistic , there group box , nothing else. have tried setting style sheet this: ui->groupbox->setstylesheet("qgroupbox::title {subcontrol-position: right;}");

memory - Linux not freeing the file buffer when we execute rm or > (redirection) operator -

i have router embedded-linux , kernel version 2.4.22 . know old version have deal it. following free command output on box, [8300002902-3] debug> free total used free shared buffers mem: 128104 123928 4176 0 2164 swap: 0 0 0 total: 128104 123928 4176 now problem whenever execute commands , redirects output file using > operator buffer size increased 4kb , if remove same file using rm -rf buffer again increase 4kb . due when buffer size reaches @ near 5.3mb of size oom problem occurs can see have 128mb ram available. think kernel not reclaiming buffer space. please tell me can done rid of problem. have researched setting drop_caches value in /proc/sys/vm command not available @ kernel version. here proc/meminfo dump may can help. [8300002902-3] debug> cat /proc/meminfo total: used: free: shared: buf

refactoring - Confirming many duplicate files are the same (diff) -

the previous person work on project i'm updating had bad habit of copying of files new directory when got new client. have 10 directories on 100 files each , i'm 99% same. refactor project , eliminate duplicate code. due number of files time prohibitive use windiff , manually compare them confirm. files .jsp files i.e. plain text files. is there program can point @ directory , have search sub directories files specific name , run diff on them @ once? if not has run similar issue , efficient way resolve it? diffmerge enables directory comparison , merging.

Find and replace img src in iframe with jquery -

i feel i've been searching forever solution. i want replace image url 1 on site i'm displaying in iframe. after hours of research i've done i've landed on using jquery handle task. unfortunately, of solutions i've found use click event trigger changes in iframe. want change happen on page load. i have limited jquery experience answer , right in land, haha. so far i've found code supposed identify class contains image want replace i'm not sure how use replacewith(or if right thing use) in jquery. this code have been using: <html> <head> <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script> <script type="text/javascript"> $(function() { //here have control on body of iframe document var ibody = $("#iframe").contents().find("body"); //here have control on element (#myconte

java - How to return parametrised List<T> in Interface RequestSpecification? -

when get request interface requestspecification , want return parametrized list<t> , must in method .as() ??? highlight bold! maybe must specify 1 of implementations of list? need specific parametrized list ! list<> response = given().parameter(x,x) .expect() .statuscode(200) .when() .get("some kind of get") **.as(list<>.class)** welcome type erasure. lists same @ runtime. unless have type information of parameter type class object, can is: @suppresswarnings("unchecked") list<desiredtype> response = (list<desiredtype>)given().parameter(x,x) .expect() .statuscode(200) .when() .get("some kind of get") .as(list.class); be aware though if puts in objects not of type desiredtype , encounter problems when accessing list later on.

regex - NGINX Redirect Loop for a single page -

i have nginx webserver , trying redirect page www.example.com/newsletter to www.example.com/blog/category/newsletter but redirect rule have matching both locations , causing redirect loop. how can make rule ignore /blog/category page while still redirecting /newsletter page? the redirect rule using is: rewrite ^/newsletter$ https://www.example.com/blog/category/newsletter permanent; not @ regex , not sure need use final page excluded redirect loop. i wouldn't handle rewrite, try instead location = /newsletter { return 301 $scheme://www.example.com/blog/category/newsletter; }

SQL: how to select IDs according to a condition? -

i started program in sql , have bit of problem (n.b., working of tabl come game). table this, id refers single person, h hour of playing , if condition: id h if 01 1 0 01 2 0 01 3 0 02 1 0 02 2 1 03 1 0 03 2 1 03 3 0 03 4 1 in case player 01 played 3 hours, player 02 2 hours , player 03 4 hours. in each of these hours may or may have not performed action. if did, 1 appears in if column. now, doubt is: how can query have table id of people never performed action? not want rule out row if = 1, want rule out row id. in case should become: 01 1 0 01 2 0 01 3 0 any help? this should it. select * table id not in (select id table if = 1)

c++ - How do I disable Unused Variable warnings in Eclipse in minGW? -

how can disable following warning in c++ in mingw? warning: unused variable 'x' [-wunused-variable] in eclipse cdt, can't locate warning number: ../src/subfolder/classtwo.cpp:20:8: warning: unused variable 'x' [-wunused-variable] i tried doing this: #pragma warning(push) #pragma warning(disable: ?) //which number? #include "subfolder/classtwo.h" #pragma warning(pop) but didn't work. my questions: how can warning number of in eclipse cdt? how should pragma directive written? it looks output clang. can achieve same using clang using approach outlined here: http://clang.llvm.org/docs/usersmanual.html#controlling-diagnostics-via-pragmas : #pragma clang diagnostic push #pragma clang diagnostic ignored "-wunused-variable" #include "subfolder/classtwo.h" #pragma clang diagnostic pop if that's source file, fix warning . for gcc, can use this: selectively disable gcc warnings part of translation

java - swing gui flickering white error -

i have gui i'm making program has outer container centered jframe contains inner container holds 22*12 cells. when run program, background flickers white , stays that. if point me out i'm going wrong awesome! public class gui extends jframe { private jpanel outer, inner; private jlabel[][] labels = new jlabel[22][12]; public gui() { setbackground(color.black); setsize(1000,1000); setdefaultcloseoperation(jframe.exit_on_close); setlayout(new borderlayout()); outer = new jpanel(); outer.setlayout(new borderlayout()); outer.setsize(620,920); outer.setbackground(color.white); inner = new jpanel(); inner.setlayout(new gridlayout(22,12,10,10)); inner.setsize(600,900); inner.setbackground(color.white); (int = 0; < 22; i++) { (int j = 0; j < 12; j++) { labels[i][j] = new jlabel(); jlabel label = labels[i][j]; label.setsize(50,50); label.setbackgroun

sql server 2005 - Self join/update of table with data in same table -

due combining old , new system data in table have list of data this: work no work name ========= ========= 123456 james 123456 james, (123456) and want update to: work_no work_name ========= ========= 123456 james 123456 james i tried building update statement, wasn't confident in ran equivalent select statement see returned , seems running in infinite loop (there's 200k records , when stopped it @ somewhere in 2 million returned!) although returning @ start looked fine seemed duplicating or something: update c1 set c1.work_name = c.work_name table c1 inner join table c on c1.work_no = c.work_no charindex(',',c1.work_name) > 0 only got experience doing simplest update statements - bit stuck 1 if suggest doing wrong , best way rectify it? thanks andrew do have index built on work_no? did try: update #table set work_name = (select top 1 c.work_name #table c #table.work_no = c.work_no , charindex(',',c.wor

artificial intelligence - Crossover different length genotypes -

e.g. have 2 random representatives 1 6 8 9 0 3 4 7 5 and 3 6 5 7 8 5 what ways crossover them? add empty numbers (or operations or sth) on end of every genotype have same size? 3 6 5 7 8 5 -1 -1 -1 where -1 means nothing? or copy few number first genotype , second? what way use? if have variable length chromosomes, shouldnt matter how it, need select crossover point each of them, , crossover normal. for example using chromosomes, have selected 2 points (.) @ random: 1 6 8 9.0 3 4 7 5 3 6.5 7 8 5 with resulting chromosomes: 1 6 8 9.5 7 8 5 3 6.0 3 4 7 5

CodeIgniter handle URL segments -

i keep thinking how deal urls , pages ci can't think way this. i'm trying handle url this: site.com/shop (shop controller) site.com/shop/3 (page 3) site.com/shop/cat/4 (categorie , page 4) site.com/shop/cat/subcat/3 (cat & subcat & page) is there way ? you create controller functions handle: shop , shop pages categories , category pages subcategories , subcategory pages controller functions in shop controller have following functions: function index($page = null) { if ($page === null) { //load default shop page } else //check if $page number (valid parameter) { //load shop page supplied parameter } } function category($category = null, $page = 1) { //$page page number displayed, default 1 //don't trust values in url, validate them } function subcategory($category = null, $subcategory = null, $page = 1) { //$page page number displayed, default 1 //don't trust values in u

javascript - Table drag and drop (holding only one column) -

i wanted draggable table rows, found tablednd jquery plugin , works fine $(function() { $("table").tablednd(); }); as can see there: http://jsfiddle.net/drbfs/1/ . but wanted make 1 column draggable. mean, whole row (tr) moved now, can move row dragging left column (td.drag), when trying drag right column should no effect. have got idea how can done? it appears older plugin, might have been possible @ 1 point, according document: http://isocra.com/2008/02/table-drag-and-drop-jquery-plugin/ however, after looking through source now, no longer possible. instead, perhaps consider using jquery ui sortable. if wrap rows in tbody, code want: jquery(function () { jquery('table tbody').sortable({ handle:'.drag' }); });

SSIS to create flat files from data in two tables -

i need create flat file data in 2 separate tables looks below table 1:- messageid|storeid 1 1234 2 5678 table 2:- messageid|productid|quantity|pickmethod 1 1111 3 z 1 0923 5 g 1 4323 1 z 2 9343 2 g 2 2334 6 z 2 2331 7 z in above 2 tables messageid foreignkey b/w 1 , table 2 i need create flat file looks below 0,xyz,20130303 1,1234 2,1111,3,z 2,0923,5,g 2,4323,1,z 1,5678 2,9343,2,g 2,2334,6,z 2,2331,7,z 9,10 in above file row starting 0 header , row starting 1 storeid , rows starting 2 details particular store(productid,quantity ...) thanks

spring - Compression servlet filter that supports minimum object size -

i wish add compression our spring based web-service (serving both xml , json), see there number of different gzip compression filters, not sure which accepted common i.e. there jboss or spring offering? additionally have read compressing content below 1000-860 bytes pointless compression time greater time saved , if below 150 bytes object grows . do these filters support minimum object size out of box? this old thread, compression in filter happens before jsp rendered. possibly enable through apache, doing filter using servlets/filters or spring mvc isn't going you: http://forum.springsource.org/showthread.php?45604-using-gzip-for-compression-how i notice reading question using xml , json responses. possibly still gain benefit @ spring mvc/controller level if looking for, still pursue gzip capabilities in apache. http://betterexplained.com/articles/how-to-optimize-your-site-with-gzip-compression/

xml - Converting from Oracle to SQL Server -

using xml, code piece in question looks like: <field name="case" when max(b.expected_date) %lt% current_date %q%0000-00-00%q% else to_char(max(b.expected_date), %q%yyyy-mm-dd%q%) end" title="qoo expected" type="date" /> i have tried changing to_char convert , current_date getdate. nothing working far. here changes: <field name="case" when max(b.potduedate) %lt% getdate %q%0000-00-00%q% else convert (max(b.potduedate), %q%yyyy-mm-dd%q%) end" title="qoo expected" type="date" /> the error receive is: incorrect syntax near 'b.potduedate'., sql state 37000 getdate function in oracle, may need add () work. getdate()

.net - feed, home, post not giving actual wall posts in Facebook C# SDK -

i trying retrieve facebook wall posts of user using facebook c# sdk. i using feed connection, gives me entries shown in "activity log" section in facebook account not shown on wall. need special parameters or anything? can please point me right direction? ok. figured out. issue permissions not being passed correctly(due silly coding mistake). getting "accesstoken" without permissions. added required permissions , worked expected. anyways, help.

javascript - KnockOut binding breaks after moving DOM element -

i have web app built on ko , part has been god-sent. however, have 1 frustrating problem. when move element jquery 1 spot in dom another, bindings seem randomly break. survive move, don't. know might causing this? wish give specific example, can't seem re-create in simple case (for fiddle) , random (3 in 10 tries). is there way refresh bindings in element? cheers, had similar issue. happening me when moving dom element before applying bindings. make sure applybinding calls made before move dom element. that can give without code sample.

PHP Checkbox email not working -

i php form display radio boxes have been checked. in other words when contacts me via email through website, display radio box ticked. i've tried cannot work! html code far - <table width="308" border="0"> <label> <input type="radio" name="servicetype[]" value="checkbox" id="technical support" /> technical support</label> <label> <input type="radio" name="servicetype[]" value="checkbox" id="information services" /> information services</label> <tr> <td align="left"> <input name="submit" type="submit" id="submit" class="contact-class2" value="send"/> </td> </tr> </table> </form> php far <?php $field_name = $_post['cf_name']; $field_email = $_post['cf

asp.net - session, DB or cookie in eCommerce site -

i creating 1st ecommerce website. after searching lot confused whether use session , db or cookie . some says session best because not every user purchases have in cart, db heavy. some says db should used cart data persist in different sessions . what best choice? sites do? note: user must login buy something. edit: that, when user add in cart insert in db temptable have foreign key of userid(user must login buy something). when users checkouts records table deleted , inserted perminent table. if user left pc few hours, have login , data there(session problem solved). if uses pc, have login , data there(cookie problem solved). if removed cookies, data still there(cookie problem solved). is technique? personally wouldn't rely on sessions hold basket. customers can quite spend time on site, wander away - perhaps desk. should happen, , have left browser , session expires, cart... there plenty of other reasons too. maybe started shopping, closed

MySql: Add information into multiple tables with one command -

i using php , mysql. want insert multiple tables 1 command. can done stored procedure or function? if so, call function php? eg (psuedo code, don't code in mysql often): hash %list = {"ip", "network_table"; "gateway", "network_table"; "name", "server_table"); function lookup (string $s) { //look value of s in hash , return corresponding table $table = $list[s] return $table; } function dotheinserting (hash $input) //or hash_ref? or array? { each $key in $input{ $table = &lookup $key insert $table ($key) values ($value) } } some problems arise if have multiple "not null" columns. viable way? there better way if need go entering information multiple tables @ once?

osx - Folder browser/picker breaks when ported to Mac -

i've been searching awhile answer this, vague, i'm still pretty clueless. created program opens 2 files, synchronizes them, , saves file location user chooser. works perfect on windows, assumed run on (stupid assumptions...), broken on mac. i've been able fix opening of folders, need saving section fixed. heres code: function getfolder(strpath string) string dim sitem string dim sfile string dim fldr filedialog set fldr = application.filedialog(msofiledialogfolderpicker) fldr .title = "select folder" .allowmultiselect = false .initialfilename = strpath if .show <> -1 goto nextcode sitem = .selecteditems(1) end nextcode: getfolder = sitem set fldr = nothing sfile = "\" & ssubid & "-" & ssubsession & "-synced.txt" activeworkbook.saveas filename:=sitem & sfile, fileformat:=xltextwindows, createbackup:=false end function i need able control name of file program (subject's id ,

python - Django user in tornado -

i have been using code below django user in tornado: from django.conf import settings import django.contrib.auth import django.utils.importlib import tornado tornado.options import options import tornado.web import tornado.ioloop import sockjs.tornado class routerconnection(sockjs.tornado.sockjsconnection): def get_current_user(self, info): engine = django.utils.importlib.import_module(django.conf.settings.session_engine) session_key = str(info.get_cookie(django.conf.settings.session_cookie_name)).split('=')[1] class dummy(object): pass django_request = dummy() django_request.session = engine.sessionstore(session_key) user = django.contrib.auth.get_user(django_request) return user def on_open(self, info): user = self.get_current_user(info=info) if __name__ == "__main__": import logging router = sockjs.tornado.sockjsrouter(routerconnection) app = tornado.web.a

shiro - "Error listenerStart" error while starting -

i trying integrate shiro based on excellent article penned balusc in application. added required jar files (shiro-core-1.2.1.jar, shiro-web-1.2.1.jar, slf4j-api-1.7.5.jar , slf4j-simple-1.7.5.jar). modified web.xml. , added shiro.ini file. however, throws following error on jboss eap 6.0. 3:32:34,470 error [org.apache.catalina.core.standardcontext] (msc service thread 1-3) error listenerstart 13:32:34,470 error [org.apache.catalina.core.standardcontext] (msc service thread 1-3) context [/fedsep] startup failed due previous errors

Use JSON.stringify but the data still have array, what does it mean? -

i have data object array. contains object arrays in tree structure. use json.stringify(myarray) data still contain array because see [] inside converted data. in case, want data converted json object not array regarding need used data on treetable of sapui5. maybe misunderstand. please me clear. this example of data got json.stringify. [{"value":{"id":"00145e5bb2641ee284f811a7907717a3", "text":"bi-ra reporting, analysis, , dashboards", "parent":"00145e5bb2641ee284f811a79076f7a3","type":"bmf"}, "children":[{"value":{"id":"00145e5bb2641ee284f811a7907737a3", "text":"webintelligence_4.1","parent":"00145e5bb2641ee284f811a7907717a3", "type":"twb"},"children":[{"value":{"id":"00145e5bb2641ee284f811a7907757a3", "text":"func

Possible with one MySQL query? "column contains any of the array's values" -

basically want check whether mysql text column, contains comma-separated values, contains of values contained in array. know can done loop , multiple queries, hoping single query. possible? thank you. i use solution this: select * yourtable str rlike concat('[[:<:]]', replace('values,in,the,array', ',', '[[:>:]]|[[:<:]]'), '[[:>:]]') this make following string: 'values,in,the,array' like this: [[:<:]]values[[:>:]]|[[:<:]]in[[:>:]]|[[:<:]]the[[:>:]]|[[:<:]]array[[:>:]] [[:<:]] , [[:>:]] word boundaries match whole words, , | or match of words. please see fiddle here .

Alternative to Pre/Post Build Events in Visual Studio -

the pre/post build events in visual studio has bugged me few years, haven't got around research better alternative. thing want achieve pretty same post build events: call piece of code before or after project build. the 2 things pre/post build events bugs me (1) code separated project , compiled command line .exe , (2) every error end cryptical message in error pane. i ideally want write static method inside project gets called before or after project builds , if exception pops up, gets stack traced other exception in debug mode. what existing (simple) approach can use done?

linux - Using shell variables in Python script is not working -

i have shell script parameters being set like: k.sh: export var="value" export val2="value2" then have python script calling shell script , want use these enviornment variables ex1.py: import subprocess import os subprocess.call("source k.sh",shell=true) print os.environ["var"] but getting keyerror how can use these shell variable in python script? you source k.sh and run python one-liner print contents of os.environ json. use json.loads convert output dict in main process: import subprocess import os import json pipe = subprocess.pipe output = subprocess.check_output( ". ~/tmp/k.sh && python -c 'import os, json; print(json.dumps(dict(os.environ)))'", shell=true) env = json.loads(output) print(env["var"]) yields value

crystal reports - Shared variable content lost through drill down -

using latest version of crystal report. in page header have subreport fetches dates shared date variable. in 1 of grouping have hidden section, therefore available through drill down, runs subreport recalling same shared date variable initial subreport. if don't hide grouping information passed through shared variable fine. if hide grouping , drill down on section content gets lost. has ever had same issue? if not in drill down can't use it. use make field super tiny , make font white doesn't appear on report, still leave in drilled down section.

visual c++ - c++ operator is ambiguous and other -

hi have c++ project gets me weird error have no idea how fix. if can give me solution, great. #include <iostream> #include <string> #include <fstream> #include <vector> #include <algorithm> #include <iomanip> using namespace std; using std::ostream; using std::endl; using std::cout; class cstudentemploy { private: string m_strname; string m_strfacnum; int m_iminutes; public: cstudentemploy(int m = 0) // podrazbirasht se konstruktor { m_strname = "n/a"; m_strfacnum = "n/a"; m_iminutes = m; } cstudentemploy(string n, string f, int m) // ekspliciten konstruktor { m_strname = n; m_strfacnum = f; m_iminutes = m; } cstudentemploy(const cstudentemploy &obj) // copy konstruktor { m_strname = obj.

Multiply numbers after each other -

exercise product1ton (loop): write program called product1ton compute product of integers 1 10 (i.e., 1×2×3×...×10). try computing product 1 11, 1 12, 1 13 , 1 14. write down product obtained , explain results. how can this, , multiple ways? try this: private int product1ton(int n){ int result = 1, ctr = 1; while(ctr <= n){ result *= ctr++; } return result; } hope helps.

C++ Class returning old values? -

i can't seem figure out why code, class test{ public: int number; test(int pass){ number = pass; } }; int main(){ test x(3); test y(2); test z[2]={x,y}; y.number = 1; cout << "z[0].number: " << z[0].number << endl; cout << "z[1].number: " << z[1].number << endl; cout << "x.number: " << x.number << endl; cout << "y.number: " << y.number << endl; return 0; } comes output, z[0].number: 3 z[1].number: 2 x.number: 3 y.number: 1 instead of one, z[0].number: 3 z[1].number: 1 x.number: 3 y.number: 1 how can make second output possible? i've searched 3 days, , still no luck :( when say: test z[2] = {x, y}; z holds 2 copy-constructed instances of test . since didn't put in copy constructor, uses default, copies data members. thus, z contains copy of x , copy of y . that's why changing y d

reference - My C# Assembly or my code? -

hello have code: private void button1_click(object sender, eventargs e) { if (radiobutton1.checked) { udp.startflood(textbox1.text, convert.toint32(textbox3.text), int.parse(textbox4.text), int.parse(textbox2.text), int.parse(textbox5.text)); } } i error "the type or namespace name startflood not exist in namespace udp(are missing assembly reference?)" here part of udp.cs: public thread[] sockets; public string _host; public int _delay; public int _sockets; public int _port; public int _timeout; public void startflood(string host, int32 delay, int socketss, int port, int timeout) { _host = host; _delay = delay; _sockets = socketss; _port = port; _timeout = timeout; sockets = new thread[_sockets]; (int = 0; < _sockets; i++) { sockets[i] = new thread(this.flood); sockets[i].isbackgro

c# - How to Copy Local Storage Image to Clipboard WinRT -

i have application, user download images local app storage, works because in order application display content dont want user have direct contact images , alter them. now want user able copy image clipboard or make copy in pictures library. problem i'm getting exception when trying it. the code example here: http://imgur.com/qnltkta if copy image selecting file picker, or getting pictures library code works fine. happens when doing local storage folder. your code has mistake. remove "\\" line storagefile storagefile = await folder.getfileasync("circulo 2_atomo.png")

iphone - my xcode organizer is disabled and all organizer are grey can NOT choose them -

Image
this happens after error appears in organizer several time when running program in xcode. error xcode has encountered unexpected error (0xc011). any guide me rid of problem highly appreciated even when late maybe else. problem either in computer nor in xcode. must check way saving data in files ( saving 2 resource @ same file). error (0xc011) logging data in files. check code, delete app. device start it. work.

asp.net - How do I trap a SerializationException in Web API? -

i have asp.net web api web service throws serializationexception in circumstances. problem i'm unable trap , log exception server-side -- place shows in body of http response client. i registered exceptionfilterattribute described in exception handling in asp.net web api , verified works when throw exception within controller. unfortunately serializationexception being thrown during response (after controller) , appears swallowed asp.net. tried hooking application_error() in global.asax.cs didn't show there either. how can catch serializationexception exceptions during web api response? if, instead of returning object, use apicontroller.createresponse() method , return httpresponsemessage can response.content.loadintobufferasync().wait() , force serialization happen whilst still in action , therefore can catch exception.