Posts

Showing posts from May, 2011

c# - Retrieve data from database column in WebMatrix -

Image
im using webmatrix 2. need retrieve data column in database. database column: i have used code retrieve data , in combobox @{ var db1 = database.open("startersite"); var selectcommand = "select motivo set_residenziali"; var selecteddata = db1.query(selectcommand); } <select name="motivo"> @foreach(var row in selecteddata) { <option value="@row.motivo">@row.motivo</option> } </select> with code result: but need obtain result: i tried many solutions, without success. in advance! you need split value: <select name="motivo"> @foreach(var row in selecteddata){ foreach(var item in row.motivo.tostring().split(new [] {','})){ <option>@item</option> } } </select>

Scrollpane not working while using jquery fade in on div -

i'm experiencing odd problem. i'm using jquery.scrollpane.js custom scrollpanes , have div hided when page loading: <script type="text/javascript"> $(window).load(function(){ $(".container").fadein("slow"); }); </script> and html <div class="container" style="display:none;"> the fade works charm, scrollpane not working more.. here's code initiate scrollpane <script type="text/javascript"> $(function() { $('.scroll-pane').jscrollpane({autoreinitialise:true}); }); </script> can out? i've got working following code: <script type="text/javascript"> $(window).load(function(){ $(".container").fadein("slow"); }); $(function() { $('.scroll-pane').jscrollpane({autoreinitialise:true}); }); </script>

windows phone 7 - Catching pressing "Back" button in mvvmlight -

how can move protected override void onbackkeypress(system.componentmodel.canceleventargs e) to viewmodel , still able control "back'ing"? in codebehind, can use e.cancel = true; , how use in viewmodel? you can't bind isn't bindable per say. can either create fake binding using behavior<t> , not point in that. instead forward event in viewmodel, doing like: e.oncancel = viewmodel.onbackkeypress(); and have onbackkeypress() return bool .

Apache virtualhost directive: only ServerName, nothing else -

if create vhost directive, catch requests on ip address. if set servername, other requests redirected documentroot of entry. how can drop requests except specific domain? e.g.: virtualhost 46.108.122.78:80 servername mysite.com (i know can specify second directive without servername , redirect e.g. empty dir. however, want explicitly drop these requests.) the first name-based virtualhost given ip:port default when no other servername/serveralias matches. # not necessary in 2.4 namevirtualhost 46.108.122.78:80 <virtualhost 46.108.122.78:80> servername xxx.example.com # unmatched hostname on goes here rewriteengine on rewriterule .* - [f] </virtualhost> <virtualhost 46.108.122.78:80> servername foo.example.com documentroot ... </virtualhost>

Saving jfreechart as jpeg shows repeating legend -

i have created jfreechart , i'm trying convert image. jframe frame = new jframe("chart"); frame.getcontentpane().add(new chartpanel(chart), borderlayout.center); frame.pack(); frame.setvisible(true); createimage(chart); //createimage method public static void createimage(jfreechart chart){ try{ chartutilities.savechartasjpeg(new file("chartimage.jpeg"),chart,800,600); } catch (exception e) { e.printstacktrace(); }

jquery mobile persistent navbar footer partly hidden -

using jquery mobile 1.3.1. created persistent navbar inside footer, works ok navbar partly shown. half of height hidden. here's code, after closing div of 'content' <div data-role="footer" dat-id="foo1" data-position="fixed" > <div data-role="navbar" > <ul> <li><a href="#" data-icon="grid">page1</a></li> <li><a href="#" data-icon="star">page2</a></li> </ul> </div> </div> what did wrong? i think of custom css messing navbar css. unless can show use whole page , maybe css there's nothing can do. in case think css not cause of problem can fix navbar position css: .ui-navbar { margin-bottom: 30px !important; } use size in px elevate navbar correct height.

html - How can I implememt the following thing using Jquery and PHP -

suppose have 2 anchor tags , 2 divs there dynamic id. example: <a id='a1' href="somepage">a1</a>& <a id='a2' href="somepage">a2</a> and <div id='d1' >text1 </div> & <div id='d2' >text2 </div> initially, divs not displayed. when press a1 <a> tag div1 shown & when press a2 <a> tag div2 show , div1 not displayed. how can implement using jquery , php? the easiest way give <a> , <div> in common. way if have lot of div won't have repeat code on , on again for example <a href='#' class='showdiv' data-div='1'>a1</a> <a href='#' class='showdiv' data-div='2'>a2</a> <!-- data-div shows div button should show --> <div class='hidden' id='box1'>one</div> <div class='hidden' id='box2'>two</div> and

html5 - Html 5 Specification -

this question has answer here: are (non-void) self-closing tags valid in html5? 6 answers in html5 should use <br> or <br /> ? same question <div> . i have noticed using breaks rendering in ie 10 causes miss calculation of height unless window re-sized. (hidden areas seem causes not figured out specific html yet) if div 's should closed </div> notice lot of library's presuming allowed (clearing floats common 1 <div class="clear" /> ) divs not self closing. <br /> xhtml. i'd bet aren't serving pages xhtml don't that. using self-closing tags in html, break show, forces browser treat markup error , has guess @ meant. it's called "tag soup". while browsers pretty job @ that, shouldn't more entering wrong code programming language , hoping software handles mistake. val

c# - Creating instance of a generic type from a instance of the type parameter -

i have bl consisting of generic repository , specific implementations couple of entity types (my dal entity framework 5 model). repository uses it's functionality method set() of system.data.entity.dbcontext. have expressions things getting siblings of entity t, these won't work on result of set(type entitytype). at 1 moment have instance of non-generic dbentityentry. entity of type object. when use gettype() approptiate entity type. know want related entity using functions in repository. there way non-generic dbentityentry. i tried: public repository(t entity) { \\ construction here } but repository<object> , call set<object> returns nothing expected. i've searched way came empty. take @ example posted george mauer in this thread. requires .net 4.0 or higher. dynamic dynamiccast(object entity, type to) { var opencast = this.gettype().getmethod("cast", bindingflags.static | bindingflags.nonpublic); var closecast

asp.net - Idea's to Create a table dynamically -

is possible create table in sql dynamically. in web application need store data in table named "info_2013" year (i.e) 2013. when system date changes 2014, new table has created "info_2014" , values have added in table. note : table has in same db. i avoid using approach. why not rather create single table, year column, identify year from? further that, if woried table getting large, might want take @ creating partitioned tables , indexes may have @ these too index basics types of indexes

.net 4.0 - MSTest hangs for seemingly no reason -

<tldr> running mstest test command line hangs without errors or timeouts whilst "waiting runs/agents". reason might "there no runs in queue", why have no idea, because exact same test runs fine on machine. </tldr> we've moved evaluating teamcity on test machine, installing in our production environment. after migrating of our build configurations got problems our mstest tests: none run. after debugging our way through can think of, think have ruled out teamcity. we're left believing directly mstest. simple way reproduce our issue, i've created test solution mstesttest (c# 4.0) in visual studio. it has 1 project mstesttest single class class1 : namespace mstesttest { public static class class1 { public static string foo() { return "bar"; } } } it has project mstesttesttest single mstest test class unittest1 : using mstesttest; using microsoft.visualstudio.testtool

if statement - Non-case-sensitive comparison of text input value with JQuery -

i have looked through answers relating writing custom selectors in jquery (such one: writing jquery selector case-insensitive version ) still unclear on if custom selector best approach problem. i want take input text box , compare list of known terms. want comparison case insensitive. here trying do: $('#query').change(function() { if ($("#query").val() == "kittens") { $('#change').text("kittens") } else if ($("#query").val() == "puppies") { $('#change').text("puppies") } else { $('#change').text("neither kittens nor puppies") } }); here jsfiddle: http://jsfiddle.net/xcbmq/ i want "kittens" , "kittens" , "kittens" match kitten condition. not clear custom selector best way this, or if can use .is() or similar. if custom selector best way it, how/where integrate code? update: here jsfiddle wo

Exists SQL Statement -

i trying find year , caseseqnumbers in table type not appellant rep 1. error coming fact year , caseseqnumber can have many rows in table. have tried: select caseseqnumber, year caseparticipants not exists (select * caseparticipants participanttype = 'appellant rep 1') any help?! you join caseparticipants itself, using left join. if join doens't succeed, means caseseqnumber , year don't have row participanttype = 'appellant rep 1' : select c1.caseseqnumber, c1.year caseparticipants c1 left join caseparticipants c2 on c1.year=c2.year , c1.caseseqnumber=c2.caseseqnumber , c2.participanttype = 'appellant rep 1' c2.year null edit to compare number of distinct combinations of caseseqnumber, year, , number of combinations have a type of 'appellant rep 1' use sql server query: select count(distinct cast(c1.caseseqnumber varchar) + '-' + cast(c1.year varcha

ios - Magical Record import (next step) -

i've put next step in title not same problem previous question exact same title. i have person entity. person -------- name - mappedkeyname: fullname email - mappedkeyname: emailaddress personid - mappedkeyname: id -------- photos and photo entity. photo -------- image createdate - mappedkeyname: date photoid - mappedkeyname: id -------- owner (type person) - mappedkeyname: userid - relatedbyattribute: personid there other objects relate person , json these comes so... { objectid : blah, owner : { id : 12345asdfg, fullname : oliver, emailaddress : oliver@oliver.com } } with json setup works import. person records don't exist (with id) created. , exist updated. however, photos json object comes this... { id : thisisthephotoid, date : today, userid : 12345asdfg } when objects come down magical record import stops when gets person import. the code crashes at... - (id) mr_relatedvalueforrela

Creating thread in windows 8 with c language -

i wanted know routine createthread works in windows 8 ? if yes enough add header file #include or other changes added in windows 8 createthread function supported windows desktop apps not supported windows metro-style apps. if see windows 8 architecture , can find win32 library not available metro apps. have use threadpool.runasync methods instead.

asp.net - Connect SQL Express Database to Team Foundation Express -

i managed use team foundation express visual studio express web 2012 want connect database (sql server express 2012) i've created. there way in sql server management studio? yes, can, although built in source control in sql management studio bit clunky, better option redgate's sql source control: redgate sql source control this works brilliantly , simple use. if want use native source control in management studio have install bits , pieces: 1/ need team explorer 2012 installed (i think need have visual studio 2012 installed, can install express version of in order working if don't have install of already): team explorer 2012 2/ need install tfs msscci provider (chose either 32 or 64 bit depending on visual studio installation): microsoft visual studio team foundation server 2012 msscci provider 32-bit microsoft visual studio team foundation server 2012 msscci provider 64-bit 3/ need set sql management studio use source control: click tools

android - Intent to view jpeg email attachments? -

i made image viewer opens image using file name. works when click image in file manager using uri, , set default viewer. however, if email image attachment (i use k9 mail client) , click on image thumb, viewer gets file name "view". makes sense, there's no file in system. of course, can save attachment , see it, don't want this. so, question is: how can make viewer attachment directly? maybe correct question: email client return when click attachment "link" in email? edit this how try open uri in code: uri = getintent().getdata(); if (uri != null) string file = getrealpathfromuri(uri); and funcion getrealpathfromuri is: private string getrealpathfromuri(uri contenturi) { cursor cursor = getcontentresolver().query(contenturi, null, null, null, null); if (cursor == null || cursor.getcount() == 0) { return contenturi.getpath(); } else if (cursor.getcount() == 0) { return null; } els

php - foreach with two kind of values -

<?php foreach ($array['response']['data']['offers'] $arr) { $gegevens = array( $arr['offer']['id'], $arr['offer']['name'], $arr['advertiser']['company'], $arr['offer']['advertiser_id'], $arr['offer']['offer_url'], $arr['offer']['default_payout'], $arr['offer']['expiration_date'] ); echo '<tr>'; foreach ($gegevens $value) { echo "<td>{$value}</td>"; } echo "</tr>\n"; } ?> this code have. how can search 2 kind of values inside foreach($array['response']['data'] ? it has foreach($array['response']['data'][**offers**] , foreach($array['response']['data'][**advertisers**] . i need can echo out $arr['**offer**']['name'] , $arr['**adverti

encoding - iconv equivalent code in Java doesn't return same results -

i have requirement encode file utf-8 shift_jis. previously, done using iconv command below iconv -f utf8 -t sjis $input_file the input file supply returns error, saying illegal input sequence @ position 2551 i have written java code: fileinputstream fis = new fileinputstream( "input.txt"); inputstreamreader in = new inputstreamreader(fis, "utf-8"); fileoutputstream fos = new fileoutputstream("output.txt"); outputstreamwriter out = new outputstreamwriter(fos, "shift_jis"); int val = 0; stringbuilder sb = new stringbuilder(); while((val =in.read() )!= -1){ system.out.println(integer.tohexstring(val)); sb.append((char)val); } out.write(sb.tostring()); out.flush(); fis.close(); out.close(); the code executes fine same input file , doesn't return error. am missing here? joachim. looks answer. have added code in question. getti

c - difference between similar bitwise operators -

in refereing bit-wise operators, difference between ! , ~ ? feel both flip bits, 1 maybe adds 1 final answer? ~0xc4 compared !0xc4 thanks! ! not bitwise operator, it's boolean operator. the boolean operators operate on truth values, int . non-zero value true, while 0 false. result 1 true, 0 false. ! boolean not && boolean and || boolean or these ones used in e.g. if since needs boolean value. boolean and/or operators short-circuiting, means stop evaluating when result known. good, means 1 || crash_and_burn() never crash , burn. but bitwise operators operate on each bit of integer-typed argument(s), after promotions , such of course. ~ bitwise not & bitwise and | bitwise or ^ bitwise exlusive-or (xor) the bitwise operators (of course) not short-circuiting, wouldn't make sense since operate on pairs of bits. note while there ^ bitwise operator, there no ^^ boolean xor operator.

jquery - Loading pdf file in child window, why does ready work but no other events -

i'm loading .pdf file in pop window. want attach event. ready event works fine, other events not. why this? this works: var desturl = "c:\mypdf.pdf; $(window.open(desturl)).ready(handler); this not: var desturl = "c:\mypdf.pdf; $(window.open(desturl)).unload(handler); at first thinking cannot add jquery page pdf document, fact .ready working makes me think otherwise. none of other events work either, .ready. it doesn't possible, @ least not cross browser. in ff using pdf.js example unload handler called, after window loads. is possible open popup javascript , detect when user closes it? has useable answer using polling.

C# .net how to deserialize complex object of JSON -

i have json string , need deserialize it. nothing worked me.. json { "response": [ { "loopa": "81ed1a646s894309ca1746fd6b57e5bb46ec18d1faff", "drupa": "d4492c3cce7d6f839b2basd2f08577f89a27b4ff", "images": [ { "report": { "nemo": "unknown" }, "status": "rock", "id": "7e6ffe36e-8789e-4c235-87044-56378f08m30df", "market": 1 }, { "report": { "nemo": "unknown" }, "status": "rock", "id": "e50e99df3-59563-45673-afj79e-e3f47504sb55e2", "market": 1 } ] } ] } i have example of classes don't have use classes, don't mind using other classes. these classes: public class report { public string nemo { get; set; } } public class image { public report report {

javascript - How do I configure different environments in Angular.js? -

how manage configuration variables/constants different environments? this example: my rest api reachable on localhost:7080/myapi/ , friend works on same code under git version control has api deployed on tomcat on localhost:8099/hisapi/ . supposing have : angular .module('app', ['ngresource']) .constant('api_end_point','<local_end_point>') .factory('user', function($resource, api_end_point) { return $resource(api_end_point + 'user'); }); how dynamically inject correct value of api endpoint, depending on environment? in php kind of stuff config.username.xml file, merging basic configuration file (config.xml) local environment configuration file recognised name of user. don't know how manage kind of thing in javascript? i'm little late thread, if you're using grunt i've had great success grunt-ng-constant . the config section ngconstant in gruntfile.js looks lik

How to make a variable icon of Android application? -

Image
usually icon fixed. want make application: when user presses icon, won't open new ui change icon itself. means has 2 status , can changed user's pression. can show code or example? thanks! the example : as can see below screenshots of phone. app icon represents cleaner. when press it, 2nd picture shows icon changes , won't enter ui, shows percent of phone's processes cleaning status. want make app effect. you cannot change application icon @ runtime, in terms of displayed home screen in launcher. you welcome write home screen app widget can respond user input , can change ui.

php - How to make cascaded select-list form to filter the content -

im trying create search form, multiple selectable options make, model, min , max year, type of gas, new, used , few others. created search box in form of several dropdown lists appropriate values , multi checkbox. i ask advice on how make search box created, filter content (appropriate parameters user selects in search box) showing in form of classfieds adds. im sorry values presented in native language should idea. below code of select lists , checkbox. big answers. <?php @ini_set("display_errors", 1);//the error handler added later in formproc error_reporting(e_all & ~((defined('e_strict')?e_strict:0)|e_notice)); require_once(dirname(__file__)."/includes/iskanje_vozil-lib.php"); $formproc_obj = new sfm_formprocessor('iskanje_vozil'); $formproc_obj->inittimezone('default'); $formproc_obj->setformid('9**66280-5820-**4b-b3**-1005ab*******'); $formproc_obj->setformkey('d**41784-8b8c-**ca-a8**-771b54******

php - Insert Backbone.js model into MySQL database -

i have backbone.js model defaults , url: var box = backbone.model.extend({ url: "./save.php", defaults: { x: 0, y: 0, w: 1, h: 1 } }); then have instance of model , proceed save it: var box = new box({ x:10, y:10, w:200, h:200 }); box.save(); now want save model mysql database using php script "save.php", goes this: <?php include('connection.php'); $id = $_post['cid']; $x = $_post['x']; $y = $_post['y']; $w = $_post['w']; $h = $_post['h']; mysql_query("insert boxes (id, x, y, w, h) values('$id', '$x', '$y', '$w', '$h') ") or die(mysql_error()); ?> echo "data inserted!"; i have tried reading many tutorials cannot simple model save work. why code not working? ideas on how can solved? thanks edit: quick solution in

Sql Server 2012 listener not working with sql server authentication with asp.net on windows server 2012 -

i in process of setting asp.net application on windows server 2012 , iis 8.0 connected sql server 2012 database alwayson availability groups database. however, having error message popping when trying access application login failure message. @ point have replicated same set on windows server 2008 r2 sp1 , iis 7.5 , site works expected. my connection string <add name="databaseconnectionstring" connectionstring="server=tcp:testdblistener;database=ibank;user id=xx;password=xxxxxxx;multisubnetfailover=true" providername="system.data.sqlclient"/> if replace testdblitener machine name of nodes works perfectly. please help

javascript - How to allow Regex expression with Spaces -

var validate = /^[@#&%][a-za-z0-9]{4}$/; i need allow spaces in regex. you need this: var validate = /^[@#&%][a-za-z0-9 ]{4}$/; note, add space within brackets.

php - Echo category name once per id -

i have query select id, title, imagename cat join images on id=id want echo once title per category , 3 images. , same next category. tables layout: cat table id title images table id imagename the final result should this: title imagename imagename imagename title imagename imagename imagename the query printed using foreach cycle object ($this->results $result ) { echo $result->title; } etc.. also i'm interested if there other ways (queries?) of getting same results. you need keep track of current title , echo title when different current one: $title = ''; // loop ... if ($result->title !== $title) { echo $result->title; $title = $result->title; } ... // end loop note need order title in query same title again later on if don't.

how to handle accessibility for web application when textbox label is not required to be shown -

in web application have textbox don't want assign label due specific purpose. in order provide accessibility requires label associated every textbox. in case how handle accessibility without providing label textbox? thanks in advance! i think can <input aria-label="my label here" /> . way won't have have label attribute/extra dom node, screen readers should still read out aria-label text. alternatively, use <label> tag , hide css.

active directory - Powershell - User creation script avoid duplicate username -

i ad search using powershell discover if username want create in use,. if in use want script add following number @ , of user name. import-module activedirectory $family= mclaren $first= tony #this part of script use first 5 letters of $family , first 2 letters of $first , join them give $username of 7 letters $username = $family.substring(0, [math]::min(5, $family.length)) + $first.substring(0, [math]::min(2, $first.length)) the user name " mclarto " base on (username take 5 first letters of family name plus 2 charof firstname) seach done in ad. if there no result, "mclarto" taken $username without number @ end. if search find other users same username, username should take following number, in case "mclarto1" . if "mclarto1" exist "mclarto2" should use , on. the answer have propose david martin there, there part if username don't exist, i don't want $username contain number if it's uniqu

php - Class for PDO vs Variable PDO -

so using pdo: config.php $pdo = new pdo('mysql:host='.mysql_host.';dbname=driptone', mysql_user, mysql_password); try { $pdo->setattribute(pdo::attr_errmode, pdo::errmode_exception); } catch(pdoexception $e) { echo 'error: ' . $e->getmessage(); } and include in every class needs connection. usage: $this->property = $pdo->prepare(); i've seen people doing via class, eg class database. running through constructor, , wanted ask, what difference between them? how create database handling using pdo , in it's own class? just extend pdo class pdo_class extends pdo { ... }

mysql - Sql query in drupal module - what is node? -

i running following query returns array of stcclass objects below: $result = db_query('select node.title node_title, node.nid nid, node.created node_created, \'node\' field_data_my_field_node_entity_type {node} node (( (node.status = :status) , (node.type in (:type)) )) order node_created desc', array(':status'=>'1', ':type'=>'_my_content_type')); stdclass object ( [node_title] => sample title [nid] => 331 [node_created] => 1367500781 [field_data_my_field_node_entity_type] => node ) it returns array of stdclass objects. problem in field 'field_data_my_field_node_entity_type' have string 'node' because passed query string. don't know this, suppose can value there if have correct syntax. any idea how query supposed work? thanks in advance

ember.js - emberjs star/unstar items just in the memory -

i build basic emberjs app, app lists posts, , every post has star / unstar event. list starred posts in sidebar, without server side communications. best way that? first idea that: create star action postscontroller, add starred posts array, , list array in template. the simplest solution can think set attribute star on post model false default, can set star true when want , render in sidebar post filtered star attribute. code (coffeescript) : app.post = ds.model.extend title: ds.attr('string') star: false app.post.reopenclass stared: -> @filter (post) -> post.get('star') true from can render app.post.stared() array in sidebar.

webdriver - com.thoughtworks.selenium.SeleniumException: ERROR: Command execution failure -

com.thoughtworks.selenium.seleniumexception: error: command execution failure. please search user group @ https://groups.google.com/forum/#!forum/selenium-users error details log window. error message is: object doesn't support property or method 'createevent' i getting above error, please me out on issue. help appreciated. seleniumserver server = new seleniumserver(rcc); defaultselenium selenium = new defaultselenium("localhost", 1212, "*iexploreproxy", "http://"); server.start(); selenium.start(); selenium.windowmaximize(); selenium.open("url"); selenium.waitforpagetoload("25000"); selenium.windowmaximize(); selenium.type("id=lgnlogin_username", "dy4cl"); selenium.type("id=lgnlogin_password", "test1234"); selenium.click("lgnlogin_loginbutton"); selenium.waitforpagetoload("10000"); string msg = selenium.gettext("//table[@id='lgnlogin']/tbo

multiple checks in a 'if statement' in C language but not working -

i have code this. int l=25; float x; value x allotted long calculation if(x<=l) x=x-l; but not changing value when x=l. i have tried if(x>l || x==l) even in case, value of x not change x=l. please either x greater 25 , have been fooled thinking 25 software not display entire value correctly or code being executed , values being used differ have shown in question.

c# - CreateSQLQuery works but QueryOver doesn't with NHibernate -

Image
so i'm trying execute basic select query table return rows. right have object representing data in table , mapped in hbm.xml file. far know, mapping correct (it's simple table auto-incrementing key , string value). when do: session.createsqlquery("select * db.table").list() for example, resulting query works. however, if do: session.queryover<myobject>().list() the result null. usually when happens because xml file not marked embedded resource in project. see here:-

Mysql warnings at one server and errors at other server -

i working mysql server. trying update query using function str_to_date(dateofbirth,'%m %d,%y') . i trying @ ubuntu server , executing few warnings wherever date format varied. giving me errors @ windows os , unable execute query saying incorrect date value. is mysql server version problem or settings errors can changed warning.

spring - Front end technology / framework -

Image
i using spring mvc , hibernate project. little confused technology use in front end part(in jsp part), better , fill easy adopt. thanks in advance, :) i suggest gwt spring , hibernate if fits requirements. gwt has great widgets , vibrant community. there's gwtp , nice mvp framework gwt. for other options, go through matt raible's java frameworks comparison . spend 2/3 days pick 1 fits requirements best.

assembly - Why REP can be added to any String Data Transfer except LOADS? -

rep stosb (stosw or stosd ) rep movsb rep insb rep outsb those string data transfer allowed rep lodsb not ? the rep lodsb , rep lodsw , rep lodsd , rep lodsq instructions valid. there's never use them though, can't data you've loaded. the case can think of might useful areas of memory mapped io read side-effects (which extremely rare).

asp.net web api - Web.API works in some deployments but returns 404 in others -

i have asp.net webforms app distributed. new version adds web.api , users have been playing beta. in beta installations works fine, installs web.api calls return http 404 not found errors. can't figure out why web.api calls fail on servers works fine on others. my guess there kind of server configuration breaking routing, can't figure out is. i've rdp'd 1 of these sites , can't find obvious. this example api call: get http://site.com/api/events/27 the code: namespace galleryserverpro.web.api { public class eventscontroller : apicontroller { public string get(int id) { return "event data id " + id; } } } the route definitions, called init event of custom http module named gsphttpapplication: private void registerroutes(routecollection routes) { routes.maphttproute( name: "galleryapi1", routetemplate: "api/{controller}" ); routes.maphttproute( name: "galleryapi2",

How to grep a string in until loop in bash? -

i work on script compressing files. want 'until loop' til' content of variable matches pattern. script using zenity. major part: part="0" pattern="^([0-9]{1}[0-9]*([km])$" until `grep -e "$pattern" "$part"` ; part=$(zenity --entry \ --title="zip file" \ --text "choose size of divided parts: (0 = no division, *m = *mb, *k = *kb)" \ --entry-text "0"); if grep -e "$pattern" "$part" ; zenity --warning --text "wrong text entry, try again." --no-cancel; fi done i want accept string containing digits ended 'k' or 'm' (but not both of them) , don't accept string started '0'. is pattern ok? $ grep -w '^[1-9][0-9]*[km]$' <<< 45k 45k $ grep -w '^[1-9][0-9]*[km]$' <<< 001023m $ grep -w '^[1-9][0-9]*[km]$' <<< 1023m 1023m don't forget <<< in ex

How to draw Yaxis label in highcharts -

Image
is there way draw yaxis lable using highcharts/highstock api? value of label end value of series. color same color of series. i found there renderer api, seems difficult know exact position of point. here's older example uses renderer function: http://jsfiddle.net/jlbriggs/4frgg/4/ function(chart){ $(chart.series).each(function(i, serie){ //to appropraite 'y' position var point = serie.data[serie.data.length-1]; chart.renderer.text( //the text render '<span style="font-weight:bold;color:' + serie.color + ';">' + serie.name + '</span>', //the 'x' position chart.plotleft+chart.plotwidth+5, //the 'y' position chart.plottop + point.ploty+3).add() }); }); you using data labels, enabled last data point: http://jsfiddle.net/jlbriggs/zxlza/0/ you using 'tickpositions' property, , form

java - Generate war file from tomcat webapp folder -

i have tomcat server working, , there have webapp folder my_web_app . i didn't deploy project; have folder of application (as tomcat_dir/webapps/my_web_app ). what need war file. how can create .war file webapp? you can create .war file existing folder. using command cd /to/your/folder/location jar -cvf my_web_app.war *

C# hold key in a game application -

i'm trying make c# application, going control game. i'm trying example: hold key 150ms, hold left arrow 500ms , on. searching lot , found following code. program firstly target game , holding keys. i'm holding keys way: keyboard.holdkey(keys.left); thread.sleep(500); keyboard.releasekey(keys.left); here keyboard class: public class keyboard { public keyboard() { } [structlayout(layoutkind.explicit, size = 28)] public struct input { [fieldoffset(0)] public uint type; [fieldoffset(4)] public keyboardinput ki; } public struct keyboardinput { public ushort wvk; public ushort wscan; public uint dwflags; public long time; public uint dwextrainfo; } const int keyeventf_keyup = 0x0002; const int input_keyboard = 1; [dllimport("user32.dll")] public static extern int sendinput(uint cinputs, ref input inputs, int cbsize); [dllim