Posts

Showing posts from February, 2010

compiler construction - C# directly to machine language -

i'm looking tool gives me ability write code in c # , compiling binary file can opened , translated directly machine language, mean did not have dependency on framework .. i heard c # parser, wanted know , whether gives me ability thank you, oriel. a parser give parse tree, not machine code. as far know, there no such compiler. in large because need compile part of bcl use well.

arrays - how to push text values to their parent and siblings div. using jquery -

i need select values following input fields respective divs.. see bellow <div id='table_row_div'> <div id='txtbox'><input type=text name='from' value='<?php echo $someval?>'></div> <div id='splited'> <div new="0"><div>i want text's splited value here</div> <div new="1"><div>i want text's splited value here</div> <div new="2"><div>i want text's splited value here</div> </div> </div> these input text fileds contains (1,0,0), (0,1,1), (1,0,1) type values... above block 49 times... , want automated system splits text value, , push "one" character on each next div of attr(new); how can using jquery. tried following type of code.. var inputval = $("#table_row_div #txtbox input"); var arrayfromdb = inputval.val().split(','); inputval.closest('div&#

Dynamically set maximum scale of horizontal pointer slide in labview? -

Image
i want make primitive movie player in labview. want user able load in movie , have slider select frames. such, want range of slider go 0 n n number of frames in movie. how set scale of slider programmatically? i don't see inputs slider, 1 output. here example of "horizontal pointer slide" bar taken ni website. slide bar in upper right hand corner of image. right click on slider: create -> property node-> data entry limits -> maximum create -> property node-> scale -> range -> maximum this creates property nodes can wire set maximum limit of slider.

javascript - How do I iterate over a queue, adding and deleting elements as I go? -

i want able iterate on queue, each time adding new elements queue, removing elements have dealt with. queue = [[0,8],[1,2],[2,4]] [x,y] in queue in [1,2,3] # results in new coordinate.. queue.push([newx,newy]) the problem is, not sure best way be. if delete each element array iterate, leaves empty element in array. if copy array, empty doing queue.length = 0 , iterate on copy, wont work because doing slice copy doesn't work when array contains objects. what correct way this? what should modify copy of array: queue2 = queue.slice 0 [x,y] in queue in [1,2,3] # generate newx , newy queue2.push([newx,newy]) queue = queue2 i'm not sure mean when say that wont work because doing slice copy doesn't work when array contains objects. you may have been misled read elsewhere. using slice array copy works objects: coffee> queue = [[0,8],[1,2],[2,4]] [ [ 0, 8 ], [ 1, 2 ], [ 2, 4 ] ] coffee> queue.slice 0 [ [ 0

c# - Accessing foreign keys through LINQ -

i have setup on sql server 2008. i've got 3 tables. 1 has string identifier primary key. second table holds indices attribute table. third holds foreign keys both tables- attributes aren't held in first table instead referred to. apparently common in database normalization, although still insane because know that, since key string, take maximum of 1 attribute per 30 first table room entries yield space benefit, let alone time , complexity problems. how can write linq sql query return values first table, such hold specific attributes, defined in list in second table? attempted use join or groupjoin , apparently sql server 2008 cannot use tuple return value. "i attempted use join or groupjoin, apparently sql server 2008 cannot use tuple return value". you can use anonymous types instead of tuples supported linq2sql. ie: from x in source group x new {x.field1, x.field2}

ruby - Regular expressions - Unable to match this string -

i writing ruby script requiring pattern matching. got unable match long string of 01122223_200000_1717181 on using / (\d+\_+\d+)*/ . it's matching following pattern though / \**|type:|\=*/ . can't figure out why. have checked ordering of pattern matching too. does have suggestion? you have more 1 thing going on pattern, think 1 causing matching fail: your parentheses off. you have + after underscore, don't think want/need one. you have whitespace @ beginning of pattern. of these, issue preventing getting match last one. rest of pattern should still match, though not quite way want (meaning it'll match things wouldn't want match). i'd go this: /\d+(_\d+)+/ if want accept pattern no underscores (e.g. 999999), use this: /\d+(_\d+)*/ about second question: reason it's matching / \**|type:|\=*/ \** , \=* use * quantifier, rather + . means they'll match if input contains no * or = characters @ all. \=* matches empty s

sql server - How can I copy several columns from table1 into table2 while ALSO defining certain static rows in table2? -

i understand how copy column 1 table another, need + define values of columns in table2 according local variables within stored procedure. is there way in 1 go? help! if understand question correctly, can select variables' values inline columns second table, so: -- pseudo-declarations clarify example create table t1 ( col1 int, col2 int, col3 int, cola varchar, colb varchar ) create table t2 ( col1 int, col2 int, col3 int ) declare @vara varchar declare @varb varchar [...] -- can select whatever other values need alongside columns source table insert t1 (col1, col2, col3, cola, colb) select col1, col2, col3, @vara, @varb t2

Log.php returning 'Invalid User' from MySQL database -

i hosting website local computer (using mamp pro on mac), , need switch hosting local mac. have copied across of files website, , mysql tables, , checked server , mysql running ok. seems fine, except login system returning "invalid user" when try log in, though entering correct user info (i have tried few users sure). the log.php handles login looks this: <? session_name("mylogin"); session_start(); if($_get['action'] == "login") { $conn = mysql_connect("localhost","root","password"); // mysql connection data $db = mysql_select_db("nick"); //put database name in here $name = $_post['user']; $q_user = mysql_query("select * users login='$name'"); if(mysql_num_rows($q_user) == 1) { $query = mysql_query("select * users login='$name'"); $data = mysql_fetch_array($query); if($_post['pwd'] == $data['password']) { $_session["name"

css - Div height not resizing when height is given as %, but will when given as number in firefox -

my problem have 1 div nested inside large div. larger div called content, , smaller 1 content-middle. content div first (and only) element inside tag, , resizing. css follows: body, html { height:100%; margin:0px !important; padding:0px; background-color:#003a69; } #content { width:100%; min-height:100%; position:relative; background-color:#00693e; background: url(images/background-green.jpg) repeat; } #content-middle{ background-color: white; margin:0px auto; width:930px; height:auto !important; height:100%; min-height:100%; color:black; } the html structure this: body->content->content-middle the problem in firefox, div content-middle not resize size of container (100%) if put in 10000%. however, if put number in min-height (such 10000) resizes properly. this works in opera, ie doesn't work (not surprising), havn't tried else. bug? can figure out workaround? thanks in advance!

python - How to determine whether the cursor is inside a gtk.Menu? -

i have gtk.menu (which being used popup) , need determine whether mouse cursor inside confines of menu. i can mouse's position on screen using this method . how dimensions , position of menu after calling menu.popup(...) ? looks didn't close enough @ of methods gtk.menu provides. it turns out gtk.menu descendant of gtk.widget has method get_window returns menu's underlying gtk.gdk.window . from there, it's matter of calling get_frame_extents() returns gtk.gdk.rectangle position , size of menu.

jquery and xml. Getting nodes as list items -

i trying parse xml , of fine. however, having trouble getting nodes , creating list items. code far $(xml).find('section1').each(function (i) { var mylink = $(xml).find('link').text(); $('#set1').find('ul').eq(i).append("<li>"+mylink+"</li>"); }); but happens takes of "mylinks" nodes , puts them in 1 <li> . ideas on crating <li> each mylink node? thanks maybe need change $(xml) $(this) inside loop? and fixup append code (you have 1 list, right? if so, remove .eq stuff) this: var $list = $('#set1').find('ul'); $(xml).find('section1').each(function () { var mylink = $(this).find('link').text(); $list.append("<li>"+mylink+"</li>"); }); if works, might able simplify down this: var $list = $('#set1').find('ul'); $(xml).find('section1 link').each(function () { var mylink =

python: lenient version of iterator.groupby that skips the records on exception -

i using iterator.groupby group similar entries in iterator based on attribute value this: employment = dict(itertools.groupby(xtable_iterator), operator.attrgetter('key_to_ytable'))) key_to_ytable attribute can throw exception. so, whole dict constructor fails. skip entries 'key_to_ytable' attribute access throws exception , process remaining entries using groupby. what alternatives? 1. inherit groupby , override functions or write custom groupby 2. use custom attrgetter returns none on exception , filter out nones 3. other solution? some background: have library encapsulates database table iterator of record object. attributes of record object columns. in case of foreign key, library looks corresponding table , fetches value attribute value. unfortunately, tables not guaranteed in sync. so, foreign key may refer non-existent record, in case, library throws exception. i vote custom attrgetter in situation, like: employment = dict(itertoo

cocoa - Incompatible pointer type with NSDate -

i can't see why doesn't work. following code block throws warning @ addobject line: "passing argument 1 of 'taskwithtext:duedate:' incompatible pointer type" - (id)init{ self = [super init]; if (self) { tasklistarray = [[nsmutablearray alloc] init]; [tasklistarray addobject:[afltask taskwithtext:"@helloski" duedate:[nsdate datewithnaturallanguagestring:@"12/31/12"]]]; } return self; } it's simple don't see why doesn't work. seems match method: - (id)initwithtext:(nsstring *)newtext duedate:(nsdate *)newduedate{ if(self = [super init]){ tasktext = [newtext retain]; taskdue = [newduedate retain]; taskcompleted = no; } return self; } + (id)taskwithtext:(nsstring *)newtext duedate:(nsdate *)newduedate{ return [[[afltask alloc] initwithtext:newtext duedate:newduedate] autorelease]; } what go

php - Multiple inheriting class names versus single and selective include -

at moment have: a.php: class { ... } a1.php: class a1 extends { a1 stuff... } a2.php: class a2 extends { a2 stuff... } ... factory.php: create($obj) {return new $obj;} i'm thinking of changing to: a.php: class { ... } a1.php: class b extends { a1 stuff... } a2.php: class b extends { a2 stuff... } ... factory.php: create($obj) { require ($obj.".php"); return new b; } any comments, or dangers lie ahead? 1 class ever instantiated per php session. my first impressions: you can never load both classes memory @ once. if don't usually this, it'll make, example, unit testing hard. debugging made harder if debugger tells there's problem class b , not which class b . a class describes logical unit. there shouldn't 2 logical units same name different functionality.

c# - Copy button label to clipboard -

i'm using private void form1_load(object sender, eventargs e) { int = 1; var alllines = file.readalllines(@"c:\text.txt"); foreach (var line in alllines) { var b = new button(); b.text = line; b.autosize = true; b.location = new point(22, b.size.height * i); this.controls.add(b); i++; } } to create bunch of buttons text file how can control behaviour of buttons - want them copy label clipboard add before this.controls.add(b) line: b.click += eventhandler((s, e) => clipboard.settext(line)); this creates handler click event copies line clipboard. for more information windows forms programming starting point microsoft's own windowsclient.net website. lot of information skewed towards wpf these days there should still plenty of forms stuff around.

version control - How to Tag a single file in GIT -

i new git. trying familiarized using track changes in excel files maintaining track continuous activity involved with. files in single repository. want tag each file separately versions. possible? far found capability tag entire repository. if trying wrong, advise me on best practice. thanks in advance. edit when doing deliberately deleted previous tag make entire repository tagged( did not find way tag single files) v1.0. want reset name of tag file name , quite comfortable way things should happen, how can rollback deletion , rename previous tag (the deleted tag)? tags placed on specific commits opposed repository whole suggest in question. one way of doing suggesting making sure commit changes single file each commit, can tag commit eg. file1-v1.0 represent v1.0 of file1. what trying represent tagging these commits though? influence advice on how better process.

php - Fatal error: Call to a member function where() on a non-object in -

i've been debugging code still not successful. can me out please? class membership_model extends ci_model { function __construct() { parent::__construct(); } function validate() { $this->db->where('username', $this->input->post('username')); $this->db->where('password', md5($this->input->post('password'))); $query = $this->db->get('membership'); if($query->num_rows == 1) { return true; } } function create_member() { $new_member_insert_data = array( 'first_name' => $this->input->post('first_name'), 'last_name' => $this->input->post('last_name'), 'email_address' => $this->input->post('email_address'), 'username' => $this->input->post('username'), 'password' => md5($this->input->post('password

javascript - Naming conventions - HTML elements in JS -

how name html element objects in js? var diveditorarea = document.getelementbyid("editorarea"); var btnchecksyntax = document.getelementbyid("checksyntax"); is way? to knowledge, there no convention naming html elements in js. javascript such diverse world if there convention, hardly followed majority of community. see, example, variety of code linters , code style conventions there ( https://www.sitepoint.com/comparison-javascript-linting-tools/ ). names should show intentions clearly, code understandable. don't think adding type of html element js variable names of use clarity purposes (the 'btn' , 'div' in example), there cases adds clarity. and, if in team, should follow team's conventions. use best judgement , strive clarity in code.

objective c - Create/Edit .doc .xls files on the iPhone/iPad -

i know .doc , .xls can viewed using uiwebview want make app edit .doc , .xls files. enlighten me on how should this? or library can use or buy. i believe can utilize googls docs api. http://code.google.com/apis/documents/ http://code.google.com/apis/spreadsheets/

java - Single Sign On using openSSO -

i have 2 web applications running in java wih weblogic server, both applications have same user name , password, decided use single sign on machanism sharing session. apart opensso configuration, policy agent installation, have write java code redirect particular page 1 application application. if implemented single sign on java, please send me java part control user authentication. if opensso setup both weblogic instances, can redirect 1 application other, don't have else.

c# - How can I repopulate an array? -

i have code populates array: var counters = new[] { 1,2,4,8 } this works later on in code this: counters = new[] { 2,2,3,5 } is there way can this? new c# , still learning the code wrote in question work fine: first line create new array, second line create new array , assign new array existing variable. old integer array replaced (and later garbage collected)

How to make 3D models for Silverlight 5? -

i'am .net web developer, not know 3d yet. in silverlight 5 3d api draw stuff on screen code, no xaml 3d objects/models, wondering how 3d developers can make cool sophisticated animated 3d games , scenes sl5 3d 'windows cafe' demo? software used draw model , make light effects.. etc? how import models? how animate them? want know headlines/basics. now in silverlight 2d practices clear, draw expression blend/design or import graphics adobe illustrator xaml, use code and/or sl built-in animations animate xaml elements. equivalents make 3d silverlight 5? thank you. most 3d modeling applications support huge number of export formats. xna uses .x format supported modeling tools. have look @ tutorial

c# - WPF: Close and open windows -

in case have main window , login view.. when main window closed, login window should displayed. close so: void closeoncompleteanddisplaylogin(object sender, runworkercompletedeventargs e) { this.close(); new login().show(); } in login window open mainwindow so: this.hide(); var window = new mainwindow(model).show(); problem: when login , open mainwindow first time works fine... when close mainwindow , login again, several functions of main window stop working or start throwing exceptions.. what doing wrong here? figured "window_loaded" events not triggered on re-login.. yes, loaded not triggered if hide/show. instead use shown event initialize logic.

Silverlight Screen Blurred after Flip animation -

i have created flip animation go list of items edit dialogue. example, user sees list of items, double-clicks on item edit , screen flips display edit dialogue details. i have actual animation working except items on screen blurred. when flip list blurred. can suggest reason this. have shown below how have achieved flip. <contentcontrol x:name="editptrmaincontent" horizontalalignment="stretch" verticalalignment="stretch"> <contentcontrol.resources> <storyboard x:name="fliptoeditstart"> <doubleanimation from="0" to="90" duration="0:0:0.3" storyboard.targetname="contentprojection" storyboard.targetproperty="rotationy"/> </storyboard> <storyboard x:name="fliptoeditend"> <doubleanimation from="270"

Mysql -- inserting in table with only an auto incrementing column -

lets have table 1 column, id(which primary key) how insert new row table without specifying id? i tried this insert (`id`) values (null) and doesn't work edit: forgot mention id, primary key has auto_increment , not null attribute. edit 2: exact error when running query above column 'id' cannot null as 'id' auto-increment enable (assuming id integer), can do: insert (id) values (null) and 'id' keep incrementing each time.

javascript - Pass parameters to IFrame on dashboard CRM 2011 -

i want show aspx page in iframe on custom dashboard. page needs parameters. how can adjust url iframe can pass values crm 2011? can't find trigger or can call javascript code. thanks in advance. what kind of information looking pass? if record object-type code , unique identifier isn't enough, 1 of following: use web resource instead , have iframe inside web resource. connect via organization services custom aspx page , query need.

php - MySQL PHPMyAdmin Localhost to accept Magic Quotes -

i'm having small problem localhost on ubuntu accept data posted apostrophes php file mysql database. example: it's birthday! will not accepted localhost database , won't accept coming either. example: its birthday! will accepted localhost database , else coming long there's no apostrophes posted. how can local machine act server online accepts apostrophes data posted database? more ensuring me code works while developing. i want make localhost servers accepts data without using mysql_real_escape_string(). you need escape string before inserting database using mysql_real_escape_string() function see it's docs here update: should put magic_quotes_gpc 'on' in php.ini file make server escape special characters adding \ before them addslashes() php function recommend use mysql_real_escape_string() function because makes mysql escape string , it's better add slashes function or can use function function use : function mysq

sql - TSearch2 - dots explosion -

following conversion select to_tsvector('english', 'google.com'); returns this: 'google.com':1 why tsearch2 engine didn't return this? 'google':2, 'com':1 or how can make engine return exploded string wrote above? need "google.com" foundable "google". unfortunately, there no quick , easy solution. denis correct in parser recognizing hostname, why doesn't break up. there 3 other things can do, off top of head. you can disable host parsing in database. see postgres documentation details. e.g. alter text search configuration your_parser_config drop mapping url, url_path you can write own custom dictionary. you can pre-parse data before it's inserted database in manner (maybe splitting domains before going database). i had similar issue last year , opted solution (2), above. my solution write custom dictionary splits words on non-word characters. custom dictionary lot easier &

Why does the C++ "Hello World" project generated by Visual Studio look a little strange? -

i'm new c++ programming (although have experience in java, c#, , visual basic). have used visual studio 2010 create default "hello world" example project, when investigate sample code generates, looks little bit different code see when looking @ c++ tutorials. in investigations, i've learned there 2 versions of c++, or @ least 2 different standards. think they're called clr , cli. standard or version must learn program further in future? there's regular, plain-old, iso-standards-based c++ kind you're seeing in tutorials. if want write windows applications in regular c++, targeting win32 api (or using set of classes wrap basic functionality of win32 api, such mfc). then there's c++/cli , can thought of entirely new language (albeit superset of c++) includes microsoft's extensions in order support .net framework. standardized ecma-372 . .net framework runs on top of clr, version of c++ compatible clr called "c++/cli".

plot - Rename factors in a spineplot with R -

Image
is possible rename factor 's in spineplot ? names of factors long, overlap. thanks advices! reading spineplot , clear can pass parameters yaxlabels , xaxlabels control vectors annotation of axes. one useful function abbreviate shorten character strings. combining information spineplot example gives: treatment <- factor(rep(c(1, 2), c(43, 41)), levels = c(1, 2), labels = c("placebo", "treated")) improved <- factor(rep(c(1, 2, 3, 1, 2, 3), c(29, 7, 7, 13, 7, 21)), levels = c(1, 2, 3), labels = c("none", "some", "marked")) spineplot(improved ~ treatment, yaxlabels=abbreviate(levels(improved), 2)) not of plot functions in r have type of parameter. more general solution, might necessary rename factors before passing plot function. can access , modify factor names using levels function: levels(treatment) <- abbreviate(levels(treatment), 5) plot(improved ~ treatment)

tinymce removes the textarea -

Image
i have weird problem, first: tiny init: function recargar_tiny(){ // general options tinymce.init({ // general options mode : "textareas", theme : "advanced", plugins : "spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template", // theme options theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor&quo

c# - i have got a validation problem! -

i want validate control myself. put label , condition when press button. protected void sendbutton1_click(object sender, eventargs e) { if (questiondetailstextbox2.text.length > 5000) { questiondetailstextbox2.text = "you cant enter more 5000 characters"; } else if(questiontextbox1.text.length > 100) { questiondetailstextbox2.text = "you cant enter more 100 characters"; } else if (checkvalidation()) { questiontextbox1.bordercolor = system.drawing.color.red; } else { response.redirect("answerquestion.aspx"); } } i added regular expression validater. did this: protected void topicdropdownmenu_selectedindexchanged1(object sender, eventargs e) { subtopicdropdownlist.items.clear(); string[] chosenitem = topic[topicdropdownmenu.selecteditem.value]; foreach (string item in chosenitem) { subtopicdropdownlist.items.add(item); } } agai

PHP require works only once after clearing APC Cache, then 500 error. Why? -

i've got apc issue. parent.php including file relative path. e.g. require_once 'child.php'; if clear apc_cache, load parent.php, works. on subsequent load, fails. dying on require_once 'child.php'. clearly relative path, when saved apc_cache, not being translated on next load... apc.include_once_override turned off, isn't that. what else be? editing add error: php fatal error: require_once() [function.require]: failed opening required 'path/to/file.php' if have apc.stat=0 in config, problem related bug: https://bugs.php.net/bug.php?id=61854 setting apc.stat=1 in php config fixed problem me.

linq to sql - Entity Framework Code First Configure Schema Per Entity -

in linq sql there simple convention tell mapper database schema use - [table(name = "schemaname.tablename")] . is there similar in ef cf 4.1? rather not use annotations in entity classes keep them pure possible. sake of keeping project moving i'll make sacrifice though. this question close, not need. may outdated looks it's referring classes have been renamed or have had breaking changes since recent ef 4.1 release - entity framework 4: code first - creating db in schema? mapsingletype? edit: should mention application has 3 schemas @ moment, can't use solution changes default schema "dbo" "otherschema". the linked answer old , doesn't work because custom conventions removed final version. if want change name of schema can use fluent api: public class context : dbcontext { public dbset<yourtype> yourtypeset { get; set; } protected override void onmodelcreating(dbmodelbuilder modelbuilder) { ba

git - Private key, access Gitolite repository for Netbeans on Win XP -

where put private key have access gitolite repository form netbeans 7 ? i have created public/private key pair , did gitolite configurations described here . don't know put keys in order clone repository server using netbeans 7 (using git plugin version 0.2.11.42, able clone repository directly netbeans) ? it should in home directory of user running as. ~/.ssh/id_rsa

What's a more affordable hosting option for a Java/JDO app built on (the formerly free) App Engine? -

because of price hike announced yesterday app engine, has gone being free hosting option potentially unaffordable one. as result consider options migrating java/jdo app off app engine other hosting provider. because jdo abstracts underlying database layer, correct few sql (gql) changes , minor configuration changes ( appengine-web.xml ) required move other java hosting platform? and, secondly, other java hosting platforms offer similar level of performance lower price new app engine price structure? you go low or mid price xen vps.

Limit the number of file Upload Wordpress -

i want limit number of files upload against role in wordpress. there code or plugin available job. any kind of solution entertained. thanks i doubt there plugin stuff, can @ wp-admin/upload.php file set role-based limits there. yet, won't able control flash uploader file.

java - Netbeans deployment fails after class rename -

i writing test client webservice. it's netbeans 6.9.1 webapplication using jsf framework. have 1 managed bean calls webservice. everything worked fine until noticed typo in bean class name. servicebean , renamed servicebean first letter upper case. used safe rename function of netbeans , both filename , class signature changed expected. but had lot of trouble running application on glassfish 3.0.1. i can build application netbeans without error (even "clean & build"). if deploy there following message in server log: warnung: error in annotation processing: java.lang.noclassdeffounderror: jsf/servicebean (wrong name: jsf/servicebean) warnung: web9052: unable load class jsf.servicebean, reason: java.lang.classnotfoundexception: jsf.servicebean info: mojarra 2.0.2 (fcs b10) für kontext '/pidclient' wird initialisiert. schwerwiegend: unable load annotated class: jsf.servicebean, reason: java.lang.noclassdeffounderror: jsf/servicebean (wrong name: jsf

cocoa touch - NSDataDetector with NSTextCheckingTypeLink detects URL and PhoneNumbers! -

i trying url simple nsstring sentence. use nsdatadetector in following code: nsstring *string = @"this sample of http://abc.com/efg.php?efaei687e3esa sentence url within , number 097843."; nsdatadetector *linkdetector = [nsdatadetector datadetectorwithtypes:nstextcheckingtypelink error:nil]; nsarray *matches = [linkdetector matchesinstring:string options:0 range:nsmakerange(0, [string length])]; (nstextcheckingresult *match in matches) { if ([match resulttype] == nstextcheckingtypelink) { nsstring *matchingstring = [match description]; nslog(@"found url: %@", matchingstring); } } the result finds url , number. number detected phone-number: found url: http://abc.com/efg.php?efaei687e3esa found url: tel:097843 is bug? tell me how url without telephone number? nsdatadetector detects telephone numbers links because on phone, can tap them if link in order initiate phone call (or tap , hold initiate text message, etc). believe curren

c# - Proper usage of XML inline documentation for derived classes? -

while think understand why inline xml documentation (i.e. using 3 slashes - ///) isn't working me, i'd guidance on how work around "problem". i have interface, , 2 derived classes. 1 derived class simulation, , other talking real hardware. it's hardware implementation special simulator doesn't need do. have xml documentation hardware methods, , not simulator. however, when hover on method name, don't documentation in tooltip @ all, presumably because xml docs aren't associated interface. this makes sense, , plan put documentation in interface instead , live it. still curious, though... how else this? there magical way make tooltip aggregate of valid xml docs? in other words, since compiler doesn't know derived class being used, there way show xml docs classes implement interface? this won't solve problems ghostdoc can insert documentation derived class using base class documentation. it's worth taking anyway if you

java - How to re-populate form fields on a jsp page after failed server validation -

i have simple java mvc web application , using servlet handle form validation. if form validated, request forwarded appropriate view. however, if form fails validation, request forwarded form, displays appropriate error message(s). my question -- efficient way re-populate of form fields data entered in form user? i not using mvc framework, simple httpservlets controller .jsp view. the easiest , least effort use <input name="foo" type="text" value="${param.foo}"/> this should default "" when user first visits form. a little more can done create custom tag binds request. not solution looking for. edit: may want use <c:out value="${param.foo}"/> protect against xss attack.

testing - how to set HTTP_HOST for WebTestCases in Symfony2 -

my application generating absolute links via $this->get('request')->gethost(). problem is: when try run testcases, following error message: [exception] 500 | internal server error | twig_error_runtime [message] exception has been thrown during rendering of template ("undefined index: http_host") in "::base.html.twig" @ line 69. somehow it's clear me there no host when calling app via cli, think there must way prevent symfony2 throwing error. anyone knows how rid of it? you create request this: $request = request::create('http://example.com/path'); that make http host set.

pdf thumbnail imagemagick php not working -

Image
i using imagemagick , ghostscript in windows pc running php5 in apache. i tried <?php $im = new imagick('test.pdf[0]'); $im->setimageformat( "jpg" ); header( "content-type: image/jpeg" ); echo $im; ?> and found not working. my php info file shows imagick working... i trying generate thumbnail without saving in server hard drive... you're outputting imagick object, not image you're dealing with. output .jpg, you'd need do echo $im->getimageblob();

url - Java web app: prevent a slash from being added to the path? -

if run webapp under uri /myapp app accessed via http://example.com/myapp , url changes http://example.com/myapp/ . there way prevent this? when have such behaviour web (or application) server returns a 301 moved permanently when url without slash requested. you can see similar example when getting http://www.google.es/services http/1.1 301 moved permanently location: http://www.google.es/services/ content-type: text/html; charset=utf-8 x-content-type-options: nosniff date: wed, 11 may 2011 15:24:06 gmt expires: fri, 10 jun 2011 15:24:06 gmt cache-control: public, max-age=2592000 server: sffe content-length: 227 x-xss-protection: 1; mode=block after first http http://www.google.es/services (without slash), browser makes second http http://www.google.es/services/ (with slash). can trace http requests network tab in firebug, example. you can check web/application server configuration, , maybe can change behaviour.

asp.net mvc 2 - Is it a lazy loading query or Eager Loading ? , Slow Query, Performance needed please -

first, know if query lazy loading or eager loading. read lot on both, , not sure if understand difference between each other. 2- query, query take lot of time execute. have suggest when see query. i'll modification needed speed query. note: want opinion query , method. thanks lot. public searchlocationviewmodel getsearchlocationviewmodel( string civicnumber = null , string street = null, string city = null, list<int?> listcountryid = null, list<int?> liststateid = null, int isactive =1, string sortfield ="filenumber",

extjs - AJAX call to REST service doesn't display results in page but a call to the same response in a flat file does -

i'm trying make call wcf data services , display results in gridpanel. the call works , returns correct json except gridpanel doesn't display results. tried copying returned json file on webserver , replacing destination url that. worked correctly , displays results. so far can tell json, code , service correct don't work properly. the ext js ext.define('customer', { extend: 'ext.data.model', fields: ['id', 'customername'], proxy: { headers: { 'accept' : 'application/json' }, type: 'rest', url: 'service.svc/customers', reader: { type: 'json', root: 'd' } } }); the json service { "d" : [ {

mysql - phpMyAdmin showing rows affected = 0 -

i'm using phpmyadmin 3.3.7 mysql 5.1.49 on ubuntu 10 lamp server. in situations, phpmyadmin show rows affected = 0 when deleting or updating rows, though rows have been affected. when try same query through mysql command line, rows affected shown correctly. there kind of configuration change need make? i believe bug fixed in 3.3.10 see below bug fix reference: http://sourceforge.net/tracker/index.php?func=detail&aid=3153409&group_id=23067&atid=377408

php - Return null by reference via __get() -

quick specs: php 5.3 error_reporting(-1) // highest i'm using __get() reference trick magically access arbitrarily deep array elements in object. quick example: public function &__get($key){ return isset($this->_data[$key]) ? $this->_data[$key] : null; } this doesn't work when $key isn't set, tries return null reference, of course throws only variable references should returned reference ... tried modifying follows: public function &__get($key){ $null = null; return isset($this->_data[$key]) ? $this->_data[$key] : $null; } still doesn't work though, i'm assuming setting $null null unset() s it. what can do? thanks! just figured i'd promote question, it's relevant ( php magic , references ); __callstatic(), call_user_func_array(), references, , php 5.3.1 . i've yet find answer ...besides modifying php core. this has nothing null , rather ternary operator

html - Why is this layout broken in Chrome? -

this site: http://www.whsc.ie/ uses jquery lightbox style plugin seems breaking layout in google's chrome browser. when viewed in chrome, header of site 30 pixels taller should be. when inspecting source elements appears caused hidden elements used colorbox jquery plugin. i've tried can think of figure out , fix problem no avail. many in advance. my bad! it seems it's wordpress bug appears when user logged in. kept seeing on browsers on own machine because logged in, when went different machine bug wasn't visble. thanks replies though, appreciated.

r - Ordering of bars in ggplot -

Image
i have looked through answers in forum cannot seem find answer specific problem. have following data , want create bar chart bars ordered largest smallest in terms of "value", rather having them in alphabetical order: breadth_data <- read.table(textconnection("stakeholder value 'grantseekers' 0.90 'donors' 0.89 'community' 0.55 'hurricane relief fund' 0.24 'media' 0.19 'employment seekers' 0.12 'affiliates' 0.10 'youth' 0.09 'women' 0.02 'former board members' 0.01"), header=true) then basic bar chart: c <- ggplot(breadth_data, aes(x=stakeholder, y=value)) c + geom_bar(stat="identity") + coord_flip() + scale_y_continuous('') + scale_x_discrete('') i have tried many of different reorderings , transformations i've seen on stackoverflow cannot seem find 1 works. sure simple, appreciate help! thanks, greg you want funct

.net - How can I assert that a method of a specific class was called before another method of another class? -

here goes example of have: public class classtobetestedtest { private mock<iaservice> aservice; private mock<ianotherservice> anotherservice; private classtobetested testedclass; [setup] public void setup() { aservice = new mock<iaservice>(); anotherservice = new mock<ianotherservice>(); testedclass = new classtobetested(aservice.object, anotherservice.object); } [test] public void shouldcallaservicemethodbeforeanotherservice() { testedclass.run(); aservice.verify(x=>x.amethod(), times.once()); anotherservice.verify(x=>x.anothermethod(), times.once()); } } in sample check if called, no mather sequence... im considering setup callback in methods add kind of sequence control in test class... edit: i'm using moq lib: http://code.google.com/p/moq/ rhino mocks supports orders in mocking, see http://www.ayende.com/wiki/rhino+mocks+ordered+and+un

html - Sizing block-level elements automatically with its content -

i have following code (simplified source): <div class="container"> <div class="body"> <div class="mainstuff">...</div> <div class="secondarystuff">...</div> </div> <div class="footer">...</div> </div> the problem when browser renders page, interprets .body having 0 height, , such, footer placed right on top of .mainstuff , .secondarystuff . .mainstuff , .secondarystuff overflowing .body. how set property body adjusts size depending on content? works if content not inside element, doesnt seem adjust height according children divs... thanks please provide more code. most interior divs either floated or absolute. if floated, adding overflow:hidden parent div should adjust size fit interior divs. from described though seems mainstuff , secondarystuff position:absolute , don't have be. if are, should add position:rela

ASP.NET - IIS7 Deployment Error 500 24 50 using WCF Web Service Binding w/ AD Groups -

background: getting internal server 500 24 50 error after deploying application has compiled without errors on local machine. server application deployed on has ton of security , running iis 7.5 need specify read , write access every directory. application uses windows authentication , web service populate drop down boxes via proxy. think there might issue connecting web service or issue read/write security on files, or issue active directory authentication. for reason, internet explorer displayed can't load webpage error. error in google chrome: 500 – internal server error. there problem resource looking for, , cannot displayed. log file details: #software: microsoft internet information services 7.5 #fields: date time s-sitename s-computername s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version cs(user-agent) cs(cookie) cs(referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken 2011-05-18 13:54:46 w3svc1 fl-

javascript - google maps Uncaught TypeError: Cannot read property 'start_location' of undefined in google maps -

hi have simple function in js google maps , uncaught typeerror directionresult google directions response object passed other function function. var myroute = directionresult.routes[0].legs[0]; var warnings = document.getelementbyid("warnings_panel"); (var i=0;i<3;i++) { warnings.innerhtml += "<br/><br/>start lat = " + myroute.steps[i].start_location.lat() + "start lng = " + myroute.steps[i].start_location.lng() + "<br />"; warnings.innerhtml += "end lat = " + myroute.steps[i].end_location.lat() + "end lng = " + myroute.steps[i].end_location.lng() + "<br /> + path :"; for(var path=0;path<myro

performance - From Windows 7 Professional Visual Studio 2010 takes over a 2 minutes to load the document in the editor window -

i reformatted laptop , reinstalled vs2010, every time open asp classic solution following occurs: solution explorer loads tabs pages left open last time appear wheels spin 2-3 minutes before can begin work it fast , responsive on windows xp pro... laptop specs intel i7 m620 2.67ghz 4gb 32 bit try disabling virus scanner. had lot of trouble vs2010 having long load times until added exceptions build paths in microsoft security essentials.

jquery .validate is not a function -

jquery("form button[type=submit]:first").closest("form").validate not function everything used work in firefox 3.6.17, in ff 4.0.1 broken. works in chrome. i've verified mac osx ff 4.0.1 issue because tried on ubuntu machine running ff 4.0.1. this code: jquery("form button[type=submit]:first").closest("form").validate({ ignore: ":hidden", submithandler: function(form) { if(!jquery("#phone_1 input").hasclass("error")){ jquery("form button[type=submit]").hide(); stripphone(); return false; } }, rules: { "lead[first_name]": { required: true, minlength: 2 }, "lead[last_name]": { required: true, minlength: 2 }, "lead[phone_1]": { required: true, phone_state_validation: true }, "lead[email_address]": { required: true,email: true }, "lead[state]": { re

javascript - Maximum bar width in Highcharts column charts -

i'm using highcharts create vertical bars (a.k.a. "column charts") lot here: highcharts.com/demo/column-basic thing is, there 30 bars in chart, two. 2 wide bars in chart, looks weird, decision made set maximum width bars. way if there 2 wouldn't wider than, say, 50px, if there 50 highcharts size them in way sees fit. so problem highcharts doesn't have way explicitly set maximum width of columns. has found solution that? update: of highcharts version 4.1.8 , see adam goodwin's answer, below . for many years, way set maximum width of columns, dynamically via javascript. basically: check current bar width. if greater desired, reset series' pointwidth . force redraw make change visible. something like: var chart = new highcharts.chart ( { ... ... //--- enforce maximum bar width. var maximumbarwidth = 40; //-- pixels. var series = chart.series[0]; if (series.data.length) { if (series.data[0].barw > maximu

c# - Array Post Binding Asp Net MVC -

i'm having trouble binding arrays on asp net mvc, when object returns in post method, arrays properties returns null, here sample code made simulating problem: any glue welcome :) i have 2 classes: public class class1 { public string sampleproperty { get; set; } public class2[] sampleclass2array { get; set; } } public class class2 { public string sampleproperty { get; set; } public string[] samplestringarray { get; set; } } this 2 actions: public actionresult sampleaction() { var model = new class1() { sampleproperty = "class 1 property 1 value", sampleclass2array = new class2[] { new class2() { sampleproperty = "position 1 class 2 property 1 value", samplestringarray = "one,two,3,4,5,6".split(new char[]{','}) }, new class2() { sampleproperty = "position 2 class 2 property 1 value", samplestringarray = "seven,8