Posts

Showing posts from May, 2014

javascript - How can I use HTML fixtures with Karma test runner using Qunit? -

i'm playing karma test runner ( http://karma-runner.github.io/0.8/index.html ) using qunit ( http://qunitjs.com ). succesfully created , ran simple tests (100% javascript), i'm trying use html fixtures in order test code interacts dom nodes. i'm able load these fixtures declaring them in "files" in way: {pattern: 'fixtures/myfixture.html', watched: true, served: true, included: false} it served karma's server, don't understand how can access dom :( let's suppose fixture simple html file containing following markup: <div id="container">hello world</div> how can write test can access node (the div)? "document" related "context.html" file under "static" folder far know... html of fixture?? i'm not using angularjs... solved adopting jasmine-jquery: https://github.com/velesin/jasmine-jquery (i use jasmine fixtures, tests still written using qunit). in configuration fil

symfony 1.4 - Doctrine update php models according to db -

i need maintain symfony 1.4 app , app uses doctrine (1.2 guess). problem people modified databse without using doctrine. fix tried update doctrine models way: symfony doctrine:build-schema symfony doctrine:build-model both not show errors when access website fails due db problems. i got errors 'unknown aliases' following sriniwas advice went , guess orm not meant :(

c++ - what is the fastest way to notify another thread that data is available? any alternativies to spinning? -

one thread writes data circular-buffer , thread need process data asap. thinking write such simple spin . pseudo-code! while (true) { while (!a[i]) { /* nothing - keep checking on , on */ } // process b[i] i++; if (i >= max_length) { = 0; } } above i'm using a indicate data stored in b available processing. probaly should set thread afinity such "hot" process. of course such spin expensive in terms of cpu it's ok me primary requirement latency . the question - should write or boost or stl allows that: easier use. has same (or better?) latency @ same time occupying less cpu resources? i think pattern general there should implementation somewhere. upd seems question still complicated. let's consider case when need write items array in arbitrary order , thread should read them in right order items available, how that? upd2 i'm adding test program demons

django - Heroku push rejected, Could not communicate with vendor, please try again later -

im trying make first push heroku git first app, , i'm keep getting error: -----> compiled slug size: 29.9mb -----> launching... ! heroku push rejected, not communicate vendor, please try again later i'm trying deploy django app. error comes after installing python packages , 'discovering process types'. connectivity 100% fine. any ideas? couldn't find in center. thanks! this issue provisioning databases: https://status.heroku.com/incidents/521 should fixed now.

java - How to assembly maven project using jarjar format? -

i tried assembly plugins maven-assembly-plugin , maven-shading-plugin none of them support jarjar file format. so there maven plugin assembly uber-jar jarjar file format? it's helpful avoid resources conflicts [ spring.handlers , spring.schemas ] the maven-shade-plugin supports creation of ueber-jar furthermore maven-assembly-plugin supports little bit simpler.

java - Bean scope not working -

the code shows want create loginbean that's sessions scoped. i'll show applicationcontext , service , dao because there may configuration error in them. i noticed beans processed application scoped. (ran project , logged in , showed username on header. opened browser, went localhost , username filled in..) anyone got idea? bean: package be.neoria.swissknife.bean; import be.neoria.swissknife.model.consultant; import be.neoria.swissknife.model.klant; import be.neoria.swissknife.model.project; import be.neoria.swissknife.model.taak; import be.neoria.swissknife.service.loginservice; import be.neoria.swissknife.service.projectservice; import org.hibernate.validator.constraints.notempty; import org.springframework.beans.factory.annotation.autowired; import javax.faces.bean.managedproperty; import javax.inject.named; import java.io.serializable; import java.util.calendar; import java.util.date; import javax.enterprise.context.sessionscoped; /** * created intellij idea.

Poco C++ HTTPResponse how can i get the entire header map of a response? -

so here class need cache entire header map. figured should extract how. how can this, need iterate them this , or can them @ once? i intend store header map in cache : lrupersistentcache<string, pair<headermap, string > > *clientcache; you can create namevaluecollection (it's map-like httpresponse's parent) httpresponse: httpresponse response; // ... namevaluecollection nvc(response); lrupersistentcache<string, namevaluecollection> clientcache(100); clientcache.add("myresponse", nvc); // ...

Change the order of tracks in an embed spotify playlist -

on facebook have embed player of spotify , works fine order of play-list not right, oldest tracks @ top , newest @ bottom. there option change other way round? i'll hope receive answer you. in advance. with kind regards, the play button widget shows tracks in canonical order of playlist, , not respect custom sorting you've applied in desktop client. see canonical order in desktop client, click sorted column header until it's no longer hightlighted in white.

javascript - localStorage issue - Items not displayed (JSON/JQUERY) -

i'm trying , sort items in localstorage , output html page. this i'm doing: <script> function shoppingcart() { var totalprice = 0; var output; var productname; var productalbum; var productquantity; var productprice; var productsubtotal = 0; var totalprice; (var = 0; < localstorage.length-1; i++){ var keyname = localstorage.key(i); if(keyname.indexof('product_')==0) // check if key startwith 'product_' { var product = localstorage.getitem('product_'+i); var result = json.parse(product); var productname; var productalbum; var productquantity; var productprice; var productsubtotal = 0; var totalprice; productname = result.name productalbum = result.album;

javascript - Use input from textfield to create an URL -

since @anywhere no longer supported, i'm looking nice way let people send tweets directly page without twitter widget. it possible create url fills in text tweet: https://twitter.com/intent/tweet?text=hello+this+is+a+test+message is there way make input field , let filled in text converted text+text+text format. submitting filled in text link type of url mentioned above. so if type in words: 'i love guys!' submitting result in linking to: https://twitter.com/intent/tweet?text=i+love+you+guys ! sure! <input type="text" name="msg" /><button>tweet!</button> <script> document.queryselector('button').addeventlistener('click', function() { var msg = document.queryselector('input[name=msg]').value.replace(/ /g, '+'); location.href = 'https://twitter.com/tweet.php?text=' + msg; }); </script>

How can I prevent twitter bootstrap's label from breaking new line? -

say have text input field , label. input appears in new line right after label. need them both in same line. how can bootstrap? it depends; in form? use horizontal form : <form class="form-horizontal"> <div class="control-group"> <label class="control-label" for="inputemail">email</label> <div class="controls"> <input type="text" id="inputemail" placeholder="email"> </div> </div> <div class="control-group"> <label class="control-label" for="inputpassword">password</label> <div class="controls"> <input type="password" id="inputpassword" placeholder="password"> </div> </div> </form> alternatively, using row class different span classes should achieve result you're after: <div

Google Custom Search engine popular searches widget -

i remember years ago there used widget use google custom search engine allowed embed details of popular searches on public web pages. have been looking documentation again can implemement on site has custom search engine cannot find - google! functionality still available or should done google analytics. for answer looking links official documentation. there's custom search page discusses this. custom search help: stats the stats tab of statistics , logs page shows popular queries custom search engine. can view info day, week, month, or year—even entire lifetime of search engine. stats page provides accurate data search usage , total number of searches completed. to display popular queries on site (for example, searchers find popular pages), copy code in popular web queries page , paste pages.

php - How to change the map view corresponding to the select box address in Magento? -

how add google map in cms page , how use search? when list address in select-box @ left side. when select address means right side of map change corresponding address. using magento 1.7.0.2 . can 1 guide me. thanks in advance, you use extension change view map use extension in e-commerce http://www.growdevelopment.com/magento-extensions/store-locations-pro i hope problem solve extension fill happy

Regex to match urls using JavaScript -

i'm using regex far has been pretty good... var r = /((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\s+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi; but if have string such following... '<div>http://www.a-random-site.com/page1-blah-blah</div>another bit of text' then bit matched be... http://www.a-random-site.com/page1-blah-blah</div>another how can alter regex take account angled bracked terminate link? i edited saram 's regex pattern , tested expresso , worked sample : (?:http|ftp|https):\/\/[\w\-_]+(?:\.[\w\-_]+)+(?:[\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?

ios - E-mail dialog box is not open in iphone sdk -

in app, fetching e-mail id address box using personpicker view. when select e-mail id, try open e-mail dialog. open & close immediatly. i can't able solve issue. i got code here my code follow: -(bool)peoplepickernavigationcontroller:(abpeoplepickernavigationcontroller *)peoplepicker shouldcontinueafterselectingperson:(abrecordref)person property:(abpropertyid)property identifier:(abmultivalueidentifier)identifier{ // first , last name. actually, copy values using person object , appropriate // properties 2 string variables equivalently. // watch out abrecordcopyvalue method below. also, notice cast nsstring *. nsstring *firstname = (nsstring *)abrecordcopyvalue(person, kabpersonfirstnameproperty); nsstring *lastname = (nsstring *)abrecordcopyvalue(person, kabpersonlastnameproperty); // compose full name. nsstring *fullname = @""; // before adding first , last name in fullname string make sure these values filled in.

Return value from Jquery confirm dialog box -

im trying open jquery confirm box using following code. var = $('#confirm') .data("x","defaultvalue") .dialog('open'); alert(a.data("x")); inside dialog tried change value of x. $("#confirm").dialog({ resizable: false, autoopen: false, height: 180, width: 400, modal: true, buttons: { "leave page": function() { $(this).data("x","this test"); $(this).dialog("close"); }, cancel: function() { $(this).dialog("close"); } } }); how can modified value x. @ moment alert shows "defaultvalue". want "this test". any thoughts? ps: can't redirect using window.open() inside dialog. finally managed solve problem. thought post here, if needs it. $("#confirm").dialo

java - Unblocked read from InputStream of a BlueToothSocket while checking connection of the socket -

i trying write thread following stuffs: 1. read inputstream; 2. other routine; 3. if socket closed, throw exception. the bluetooth socket , inputstream socket has been set before this. code following: public void run() { byte[] buffer = new byte[1024]; int bytes; while (true) { try { //if(minputstream.available() > 0){ //-------- line 1 bytes = minputstream.read(buffer); //} //-------- line 2 //---------------------// // other routines // //---------------------// } catch (ioexception e) { connectionlost(); break; } } } the problem above code hang @ minputstream.read() because of blocking. however, if uncomment line 1 , line 2, minputstream.available() function not throw exception if bluetoothsocket closed. there method either unblock read function, or throw exception when avai

wordpress - Remove posts permalink (href) -

i trying figure out way remove permalink's posts category 'nolink'. have tried few java script attempts - have not managed work. <?php query_posts( 'tag=client-list' ); while ( have_posts() ) : the_post(); echo '<ul class="client-thumb-wrap">'; echo '<a href="'; the_permalink(); echo '">'; echo '<li class="'; $category = get_the_category( $custompost ); echo $category[0]->cat_name ; echo ' '; echo $category[1]->cat_name ; echo ' '; echo $category[2]->cat_name ; echo ' '; echo $category[3]->cat_name ; echo '">'; echo '<img src="'; the_field('client_logo'); echo '">';

guava - Java comparator by using priority for classes that extend a common parent class -

i need implement several comparators in java. i have lot of known classes, a1 , a2 , a3 , ..., an , extends class a . want to comparator class based on guava ordering , following: ordering<a> sortertype1 = new ordering<a>() { // here, provide set or similar keeps in memory // class types , associated priority. @override public int compare(a left, right) { // return -1 if class of left has higher priority wrt class of right; // return 0 if class of left has same priority wrt class of right; // return 1, otherwise. } since need develop lot of different comparators, don't want put priority inside class type, since there several priorities differentiated each comparator. i'm missing parts comments. what effective , efficient implementation of parts comments? don't write compare implementation yourself, use ordering super powers ( ordering#explicit(list) exact): li

Sandboxed plugins for Node.js -

i'm complete node noob, apologize if question has obvious answer. i'm looking create web app run plugins untrusted sources (i.e. community submissions). need lock down plugins sandbox access allowed (can't write disk, etc.). ideally, plugin able use approved node packages , apis. is possible in node? if so, can point me toward package or documentation me started? here small list of projects can you: https://github.com/gf3/sandbox https://github.com/hflw/node-sandbox https://github.com/bcoe/sandcastle https://github.com/wearefractal/boxy i suggest first 1 ( http://gf3.github.io/sandbox/ ) since it's more mature.

multithreading - Instruction reordering & happens-before relationship in java -

in book java concurrency in practice, told several time instructions of our program can reordered, either compiler, jvm @ runtime, or processor. should assume executed program not have instructions executed in same order specified in source code. however, last chapter discussing java memory model provides listing of happens-before rules indicating instruction ordering preserved jvm. first of these rules is: "program order rule. each action in thread happens before every action in thread comes later in program order." i believe "program order" refers source code. my question : assuming rule, wonder instruction may reordered. "action" defined follow: the java memory model specified in terms of actions, include reads , writes variables, locks , unlocks of monitors, , starting , joining threads. jmm defines partial ordering called happens before on actions within program. guarantee thread executing action b can see results of action (whet

database - Converting a schema to a second normal form -

consider basic table schema: studentid, student name, department, coursecode, course name, year-semester, grade how can convert the second normal form identifying functional dependencies? i use mnemonic device first 3 normal form. use word repeat ignoring vowels. first no repeating groups or multivalued fields, second no partial dependence on primary key , no transitory dependence. in case looks 1nf problem rather 2nf. 2nf means partial dependence , looking @ table there no composite primary key i.e primary keys having more 1 field therefore there no possibility of partial dependence. 1nf there 2 possibilities 1 has repeated groups other 1 multi- valued fields. so, example of 1nf repeating groups here and multi-valued example here it better if have actual records/rows of table , ask question: there repeating groups or there multivalued fields? there can begin answering problem using examples provided above. by way here in (stackoverflow) no-no come question w

python - How to convert base64 string to image? -

i'm converting image base64 string , sending android device server. now, need change string image , save in database. any help? try this: import base64 imgdata = base64.b64decode(imgstring) filename = 'some_image.jpg' # assume have way of picking unique filenames open(filename, 'wb') f: f.write(imgdata) # f gets closed when exit statement # save value of filename database

ember.js - Does an event handled in a child view bubbles up to the parent's one? -

if event triggered on child view, handled not in child in parent? this ember view test: test("event manager should able re-dispatch events view", function() { var receivedevent=0; view = ember.containerview.createwithmixins({ elementid: 'containerview', eventmanager: ember.object.create({ mousedown: function(evt, view) { // re-dispatch event when it. // // second parameter tells dispatcher // event has been handled. // api need reworked since // multiple eventmanagers in single view // hierarchy break, shows // re-dispatching works view.$().trigger('mousedown',this); } }), childviews: ['child'], child: ember.view.extend({ elementid: 'nestedview', mousedown: function(evt) { receivedevent++; } }), mousedown: function(evt) { receivedevent++; } }); ember.run(function() { view.appe

drupal 7 - How to create a new region in omega subtheme? -

i new in drupal development. know creating region in custom theme.but want create subtheme base theme of omega. want add new region not worked cannot add blocks in region?any 1 me? in omega subtheme .info file add new region: regions[machine_name] = 'actual name' then clear cache, go subtheme appearance settings, click "zone , region configuration" tab, , scroll down bottom find "unassigned regions". assign zone, configure options above, , save. then add block region in structure->blocks , template appropriately.

How to add records from Django (version 1.5) admin when the database (PostgreSQL) is partitioned? -

i know whether possible add new records database django (version 1.5) admin when database (postgresql) has been partitioned? more specifically, in database have partitioned (via use of triggers) table named category 2 partitions named category_01 , category_02 . after finished partitioning table, tried insert new records kept getting following error: 'nonetype' object has no attribute '__getitem__' . does have idea on how solve problem? have tried add custom save() method model well, no avail. simplest solution here? after 2 days of research, able solve issue on own. solution override save(..) method in model so: def save(self, *args, **kwargs): #custom save method #pdb.set_trace() django.db import connection connection.features.can_return_id_from_insert = false print "save" super(your model name here, self).save(*args, **kwargs) thanks django docs , postgresql docs, https://groups.google.com/forum/?fromgroups=#!

c# - randomly Select XML nodes with same names -

i have xml file: <main> <qa> <question>what favorite color?</question> <!--pick random!--> <answer>blue</answer> <answer>red</answer> <answer>green</answer> <answer>yellow</answer> </qa> <qa> <question>what favorite programming language?</question> <!--pick random!--> <answer>php</answer> <answer>c#</answer> <answer>java</answer> <answer>vb.net</answer> </qa> i want when user enter 1 of question specified in above xml file, program pick random answer nodes. example when user enters "what favorite programming language?" in textbox, program must generate php,c#,java or vb.net randomly. this code not correct: xmldocument xml = new xmldocument(); xml.load("qa.xml"); xmlnodelist xlist = xml.selectnodes("main/qa"); foreach (xmlnode xn in x

ios - how to post route map on facebook not image -

facebook providing new feature post route map , not image of map. have checked documentation , found code getting they have given kind of code nsmutabledictionary<fbgraphobject> *action = [fbgraphobject graphobject];action[@"course"] = @"http://samples.ogp.me/136756249803614"; [fbrequestconnection startforpostwithgraphpath:@"me/fitness.walks" graphobject:action completionhandler:^(fbrequestconnection *connection, id result, nserror *error) { // handle result }]; i have done this. can not ios need use php need send array of longitude , latitude php side , php side posting on map on facebook job on ios not know how @ php side

CakePHP find contain having deep orders -

i have following models: client hasmany loan loan belongsto book loan belongsto client book belongsto booktype and tables this: clients { id, name, ... } loans { id, client_id, book_id } books { id, book_type_id } book_types { id, title } i find loans clients's id. tried: $client = $this->client->find('first', array( 'conditions' => array( 'client.id' => $id ), 'contain' => array( 'loan' => array( 'book' => array( 'booktype' => array( 'order' => 'sachtitel desc' ) ) ) ) )); this doesn't work expected. data isn't sorted wanted be. what doing wrong? edit: okay, seems, long using contain , can't use order, because cakephp generates multiple queries obtain data. order useless, because 1 row fetched queries generated cakephp. how use join, fet

asp.net mvc - Most effective method of protecting an entity ID when posting back from a view -

edit - quick edit, start off clear question! i'm asking is, effective way of protecting entity identifiers when posting view? i've been thinking ways protect id on post when editing view model. let's take example entity public class post { public int id { get; set; } public string title { get; set; } public string content { get; set; } } and corresponding view model: public class postviewmodel { public int id { get; set; } public string title { get; set; } public string content { get; set; } } now, when pass view model view allows user edit it, i'm going doing this: public actionresult editpost(postviewmodel viewmodel) { post post = database.posts.single(p => p.id.equals(viewmodel.id)); post.title = viewmodel.title; post.content = viewmodel.content; database.entry(post).state = system.data.entitystate.modified; database.savechanges(); return view(viewmodel); } or maybe pass id through parameter list

jquery - How to show print dialog to select the printer while printing the SSRS report using button click -

i calling aspx report viewer page passing parameters window.open() like var popupwindow = window.open('@url.content("~/rptviewer.aspx")' + "?date=" + date,'popupwindow', 'channelmode=yes,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=no'); and printing report using reportprintdocument.cs like reportprintdocument rp = new reportprintdocument(reportviewerprint.serverreport);rp.print(); by report printing directly without showing print dialogue. now want show print dialogue selecting printer , no of copies print.. , after clicking on ok button on print dialogue have print report... per options selected in print dialogue you're printing report server side (which may same machine browser's on if you're developing) has no way show print dialog. in other words it's not client that's printing currently. to print newly opened window you'll need javascript execute c

vector - cross product in TinyOs? -

how can make cross product between 2 vector in tinyos (nesc)? if have position=p1+x*ex+y*ey; ; ex,ey: vector. i searching couldn't find thing helped !!! so there helpful way ? if go definition of cross product there angle don't how 2 vector ? if have 2 vectors , b (a = (a1, a2, a3) , b = (b1, b2, b3)) cross product can computed using following formula: a x b = (a2*b3 - a3*b2, a3*b1 - a1*b3, a1*b2 - a2*b1)

matlab - Adding up different number of elements from each row -

i have main matrix, say a=magic(5); and vector v=[1;3;5;2;2]; i want add row-wise elements of in way: add first row v(1)st element end, second row v(2)rd element end, third row v(3)th element end, , on. i know can using for-loop. want know if there vectorized way it. edit: let me clarify question example: assume , v above. a = 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 and v = 1 3 5 2 2 now want way following results: answer = 65 % 17+24+1+8+15 37 % 7+14+16 22 % 22 55 % 12+19+21+3 54 % 18+25+2+9 you can use cumsum along rows. solution bit complex, i'll start simpler example: suppose want sum elements of i -th row of a till (including) v(i) -th place: res_i = \sum_{k=1..v(i)} a_ik m = size(a,1); % num of rows csa = cumsum(a, 2); % cumsum along rows res = csa( sub2ind( size(a), 1:m, v ) ); % pick vi-th column i-th row now, quest

Trouble installing Ruby 2.0.0 on Ubuntu 12.04 -

i'm installing ruby 2.0.0 packages not found. first use command rvm stable then issue command rvm requirements i have these errors below w: failed fetch http://ppa.launchpad.net/cheleb/blender-svn/ubuntu/dists/precise/main/source/sources 404 not found w: failed fetch http://ppa.launchpad.net/cheleb/blender-svn/ubuntu/dists/precise/main/binary-amd64/packages 404 not found w: failed fetch http://ppa.launchpad.net/cheleb/blender-svn/ubuntu/dists/precise/main/binary-i386/packages 404 not found w: failed fetch http://ppa.launchpad.net/ferramroberto/oneiric/ubuntu/dists/precise/main/source/sources 404 not found w: failed fetch http://ppa.launchpad.net/ferramroberto/oneiric/ubuntu/dists/precise/main/binary-amd64/packages 404 not found w: failed fetch http://ppa.launchpad.net/ferramroberto/oneiric/ubuntu/dists/precise/main/binary-i386/packages 404 not found i try install following below https://askubuntu.com/questions/169542/how-do-i-install-the-latest-blender

console - C# prevent CMD from Closing Automatically after running? -

Image
this question has answer here: why console window closing without displaying output? 17 answers i want prevent cmd closing automatically after running program. code: static void main(string[] args) { filestream textfsw = new filestream("fileone.txt", filemode.append, fileaccess.write); // creating file streamwriter textsw = new streamwriter(textfsw); console.write(" enter id: "); int id = int.parse(console.readline()); console.write(" enter name: "); string name = console.readline(); console.writeline(" thank you! logged in as" +name+ +id); textsw.close(); textfsw.close(); filestream textfs = new filestream("fileone.txt", filemode.open, fileaccess.read); // reading file using readalllines streamreader textsr = new stre

ember.js - Re-compute an Ember object's property every interval -

currently have simple ember object, has 2 properties: startedat , endedat . based on these properties, have computed property islive . time comparison current time. when rendering handlebar template highlight items adding class highlight . <li {{ bindattr class="event.islive:highlight" }}>...</li> i'd update template every 5 seconds or so, know islive needs re-calculated. how need go that? app.event = ember.object.extend({ endedat: null, startedat: null, islive: function() { if (!this.get('startedat') || !this.get('endedat')) { return false; } var = moment(); return (now.diff(moment(this.get('startedat'))) >= 0 && now.diff(moment(this.get('endedat'))) < 0); }.property('startedat', 'endedat') }); i have done similar regular ember view {{view app.timerview}} . app.timerview = ember.view.extend({ tagname: 'time', template: em

Git for windows - unable to clone repository -

when attempt clone repository using windows git ( http://windows.github.com/ ) consistently gets stuck on 9% complete. of git specific files seem downloaded source not. i've tried updating proxy settings within .gitconfig located @ c:\users\username\.gitconfig contain proxy setting : proxy=myproxy:myport what causing issue ? i needed set system variable name = https_proxy , value = <proxy name>:<port number> for more info see accepted anwser + comments getting git work proxy server

php - fineuploader combined with edit page -

i using fineuploader in combination php. use add images blogpost. when new post added information stored in database. there edit page each post. on edit page images belong post should editable trough fineuploader. does know if there feature this? if there way parse existing images fineuploader? fine uploader not file manager, cross-browser upload library. can enable delete file feature , ask fine uploader send delete request files have been uploaded during current fine uploader session. if want delete files have been uploaded previous instance of fine uploader, need account in web app simple ajax call server orders removal of these files.

c# - Keep getting 404 eventhough I mapped my routes -

i have been dealing issues routes. have defined routes keep getting 404. here routes : routes.maproute( name: "default", url: "{controller}", defaults: new { controller = "login", action = "login" } ); routes.maproute( name: "home", url: "{controller}/{date}", defaults: new { controller = "home", action = "home", date = urlparameter.optional } ); routes.maproute( name: "calendar", url: "{controller}/{action}", defaults: new { controller = "calendar", action = "index" } ); routes.maproute( name: "act", url: "{controller}", defaults: new { controller = "act", action = "new" } ); localhost:51081/login works! localhost:51081/home/25.04.2013 works! localhost:51081/act doesnt work! localhost:51081/calendar/index doesnt work! here "login" , "home" works

sql server - Modify foreign key to create a distributed database -

i'm distributing database have tow tables foreign keys references other database in other server. search , found can't make foreign key referring table in database in other server. but, how can resolve problem? creating views? in instance needs refer "the other server", introduce "the other server" linked server , use insted of triggers validate fk constraints.

c# - TableLayoutPanel: Delete Rows -

i have tablelayoutpanel filled rows @ runtime using text file (get each row text file, , put in cells contained in new rows). code looks this: public static string urllist= @"c:\users\berisha\desktop\urls.txt"; string[] urlrows = system.io.file.readalllines(@urllist); private void initpaths() { int = 0; int c = 1; while (a < urlrows.length-1) { //new label var label = new label(); label.dock = dockstyle.fill; label.autosize = false; label.text = urlrows[a]; label.textalign = system.drawing.contentalignment.middleleft; label.size = new system.drawing.size(22, 13); label.backcolor = system.drawing.color.transparent; tbp.controls.add(label, 3, c); //add tablelayoutpanel a++; c++; } } although want able manually edit source, wrote method delete new created, seem stuck here, because

eclipse - Android add referenced android project into main android project -

i'm wondering if following scenario possible: i have in workspace 2 projects, , on of them referenced folder in other project(the referenced project external sdk) now, don't want them sit in 2 different locations since it's not svn-friendly. is there option add project project? ( can't convert jar since contains resources)

ios - TableViewCell image change when touched -

i have own tableviewcell class inherit uitableviewcell . on cell nib file, have put image in tableviewcell . (the image not occupy whole cell area, there spaces around image) then, implement touch feedback feature when user touch image in cell, image replaced image. i tried in tableview:didselectrowatindexpath: method : - (void) tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { //my tableviewcell uitableviewcell *cell = [tableview cellforrowatindexpath:indexpath]; //new image replace current 1 uiimage* bg = [cctheme imagenamed:@"green_btn_bg"]; uiimageview* bgview = [[uiimageview alloc] initwithimage:bg]; cell.selectedbackgroundview = bgview; ... but not work @ all. so, how can implement touch feedback feature?? that's when user finger touched image in cell, image changed one. create uiimageview property in custom uitableviewcell class iboutlet set image on property cellforro

c# - Include values with function delegate? -

this isn't doing, close enough. have 2 delegates pointing same function. var foo=new func<string, string, dynamic, string>(f); var bar=new func<string, string, dynamic, string>(f); foo called group of threads (not 1 thread). bar called different group of threads. one of parameters function needs know group of threads called from. i can make each thread when invokes function tell group name (the threads know group belong to), there way pass thread group name (a string) function when declaring foo , bar ? so anytime thread calls foo, function f know called first group, , everytime thread calls bar, function f know called second group ? you mean this? var foo = new func<string, dynamic, string>((s,d) => f("123", s, d)); var bar = new func<string, dynamic, string>((s,d) => f("456", s, d)); that way constant used once during declaration of delegates.

how to fix undefined index in PHP -

this little question, why getting error message? severity: notice message: undefined index: filter filename: libraries/functions.php(656) : eval()'d code line number: 43 it says problem lays here: $filter2 = $_get['filter']; i have defined filter2, want use filter2 compare if contains word 'realscan' the problem fixed if use isset(), convert integer, cant use that. if($filter2 == 'realscan') { //something here } you need check see if defined before use it: $filter2 = isset($_get['filter']) ? $_get['filter'] : '';

C++ class inheritance variables -

i'm working on game, , want store character belongs unit inside class defines units. (as objects) this defining class. (i use inheritance) class units { public: char indicator; units(); virtual ~units(); protected: private: }; units::units (){} units::~units (){} class woodenboxclass: public units { public: woodenboxclass.indicator = 'b'; }; during compilation, when "woodenboxclass.indicator = 'b';" comes, error message: 50|error: expected unqualified-id before '.' token what should do? main question how can reach "indicator" variable same every "woodenboxclass" object? you need initialize member variables in class constructor. there 2 ways it: simply assign in child-class constructor woodenboxclass() { indicator = 'b'; } have constructor in base class takes indicator argument, , use initializer list in child-class constructor: class un

Where to find "jersey" for creating a java REST Service? -

i trying build java rest service. i following this tutorial (which seems extremely popular) , 1st thing says , download jersey link : http://jersey.java.net/ however link doesnt work , , when google more , cant find anywhere place download these jar files essential build service. any ideas can find it? you can download jars from... http://www.java2s.com/code/jar/j/downloadjerseyjar.htm although i'd recommend using maven dependencies. <dependency> <groupid>com.sun.jersey</groupid> <artifactid>jersey-server</artifactid> <version>1.17.1</version> </dependency>

c# - JavaScriptSerializer won't recognize date string as DateTime? -

this question has answer here: javascriptserializer not deserializing datetime/timespan properly 2 answers here model: public class reportallmediadetailsparams { public int profileid { get; set; } public int organisationid { get; set; } public datetime startdate { get; set; } public datetime enddate { get; set; } } here deserializer: var serializer = new javascriptserializer(); var reportparams = serializer.deserialize<reportallmediadetailsparams>(json); the date coming json is: "{\"profileid\":\"41\",\"organisationid\":\"2252\",\"startdate\":\"01/01/1970\",\"enddate\":\"01/01/1970\"}" don't use javascriptserializer , use json.net instead. don't use locale specific formats such mm/dd/yyyy or dd/mm/yyyy in

css - HTML div comment box with arrow -

Image
i trying create comment box arrow. using css, have problem cannot solve. i have white background, , need make comment box white background. so, make box visible users, need put border box, don't know how put border arrow. here css: body {background: grey;padding: 40px} .comment_div { background: white; width: 250px; padding: 10px; display: block; } .pointer { border: solid 20px transparent; border-right-color: #fff; position: absolute; margin: 40px 0 0 -38px; z-index: 999; } here html: <div class="pointer"></div> <div class="comment_div"> test testtest testtest testtest testtest testtest testtest test test testtest testtest testtest testtest testtest testtest test test testtest testtest testtest testtest testtest testtest test test testtest testtest testtest testtest testtest testtest test </div> here jsfiddle . how can make border box below? here solution,

generic return type based on a Type paramater in C# -

i have class dictionary maps type keys objects implement interface iwhatever . i wish create generic function gets type input , returns object mapped type in dictionary. something : public t get<t>(type type) where t instance of type , type implements iwhatever . i don't want return object or iwhatever objects of given type. type of return objects can infered @ compile time. assume should possible. i have managed in java: public t get<t>(class<t extends iwhatever> type) { // implementation } is there way achieve in c# ? if not, why not , alternatives suggest ? i think want: public t get<t>() t : iwhatever { ... } for more information, see constraints on type parameters (c# programming guide) . this of course useful when client can provide type argument @ compile-time. internally, method may need lot of nastiness, e.g.: return (t) mydict[typeof(t)];

soap - python suds Error in XML -

i tryied couple of hours receive data soap webservice. this code: from suds.client import client suds import webfault wsdl_url = 'gatewaywebservice.asmx?wsdl' client = client(wsdl_url) checkifexists = client.factory.create('checkifexists') checkifexists.sessionid = '' checkifexists.userid = 'ttester@email.com' try: response = client.service.customerservice(checkifexists) #print response if response.error: print response.error else: pass except webfault, e: print e print client.last_sent() print client.last_received() this sent: <soap-env:envelope xmlns:ns0="asdf" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"> <soap-env:header/> <ns1:body> <ns0:customerservice>

java - How to bind the position in a List to an attribute of that element? -

i have observablelist<myelement> list = fxcollections.observablearraylist(); public class myelement { private integerproperty position;//with getter //[...] //somewhere in constructor taking list argument position.bind(list.indexof(this)); } now i'd bind myelement.position actual position in list i.e. if position changes in list (for instance drag , drop in gui or else) want position property updated automatically. is possible? can make bidirectional binding between these values? i don't know if correctly understood question, try answer :-). the thing is, once observablelist (javafx.collections) object not store kind of "selected" index state, why should bind integer it? i think, in case, code should responsible store "selected" index state , expose client code. if looking for, suggest have 3 attributes deal it: public class listselection<t> { private observablelist<t> items = fxcollections.observablear

java - JTextArea ran out of room? How much text can fit, can I fit more than that? -

i working on visualizer pattern found in prime numbers. here link maths stackmath: patterns in primes , full code stackcodereview: optimization of code my problem seems running out of room in jtextarea. errors: exception in thread "main" java.lang.outofmemoryerror: java heap space @ javax.swing.text.gapcontent.allocatearray(unknown source) @ javax.swing.text.gapvector.resize(unknown source) @ javax.swing.text.gapvector.shiftend(unknown source) @ javax.swing.text.gapcontent.shiftend(unknown source) @ javax.swing.text.gapvector.open(unknown source) @ javax.swing.text.gapvector.replace(unknown source) @ javax.swing.text.gapcontent.insertstring(unknown source) @ javax.swing.text.abstractdocument.handleinsertstring(unknown source) @ javax.swing.text.abstractdocument.insertstring(unknown source) @ javax.swing.text.plaindocument.insertstring(unknown source) @ javax.swing.jtextarea.append(unknown source) @ primesandbox.main(primesandbox.java:67) line 67: s

Python: Getting text of a Regex match -

i have regex match object in python. want text matched. if pattern '1.3' , , search string 'abc123xyz' , want '123' . how can that? i know can use match.string[match.start():match.end()] , find quite cumbersome (and in cases wasteful) such basic query. is there simpler way? you can use match object's group function, like: match = re.search(r"1.3", "abc123xyz") if match: dosomethingwith(match.group(0)) to entire match. edit: thg435 points out, can omit 0 , call match.group() . addtional note: if pattern contains parentheses, can these submatches, passing 1 , 2 , on group() .

sql - LINQ; How to perform left outer join with multiple conditions? -

i'm trying imitate: db1 left outer join db2 b on a.[currency code] = b.[currency code] , a.[document date] >= b.[starting date] , a.[document date] <= b.[ending date] this have now: from ledgers in ledgerentries join currency in currencyexchange on ledgers.currencycode equals currency.currencycode c currencies in c.defaultifempty() ledgers.documentdate >= currencies.startingdate && ledgers.documentdate <= currencies.endingdate i've read creating anonymous type , setting them equal each other, doesn't work when using less , greater comparing dates. it seems this answer looking for. from ledgers in ledgerentries join currency in currencyexchange on ledgers.currencycode equals currency.currencycode c currencies in c.where(currency => currency.startingdate <= ledgers.documentdate && currency.endingdate <= ledgers.documentdate).defaultifempty() combined this answer, able simplify

ios - Make default value of Segment unselected -

i trying load segment control array. when selects male default. want neither male or female selected , both unselected default. - (id)initwithanimal:(itanimal *)animal isedit:(bool)isedit { self = [super init]; if (self) { // custom initialization _animal = animal; _genders = [nsarray arraywithobjects:@"male", @"female", nil]; if (!_animal) { _animal = [[itdata sharedobject] managedobjectfromname:@"itanimal"]; _animal.gender = [_genders objectatindex:0]; } _isedit = isedit; // gender controll self.gendercontrol = [[uisegmentedcontrol alloc] initwithitems:_genders]; [self.gendercontrol addtarget:self action:@selector(genderchanged:) forcontrolevents:uicontroleventallevents]; } return self; } } else if (indexpath.row == 2) { bool isin = no; (id view in cell.contentview.subviews) { if ([view isequal:self.gendercontrol]) isin = yes; } if (!isin) [cell.contentview a