Posts

Showing posts from January, 2015

performance - is better to call a inBuilt VBA function with or without its Class? -

some inbuilt functions in vba can called or without class. 1 better use? when calling sub/function vba.format(date,"yy-mm-dd") 'or format(date,"yy-mm-dd") also when dimensioning variable, class might or might not used. in case, better? dim xmldoc msxml2.domdocument60 'or dim xmldoc domdocument60 i tend use class , name in case has defined function/sub/type bring conflicts. how performance? when having great amount of codes , procedures, 1 or other have impact on performance/speed? there other aspect take in account when deciding whether use 1 form or other? if understanding correctly, , if understanding of vba correct, doesn't make difference in terms of performance whether qualify property or method library prefix. don't think necessary qualify objects referenced within vba library (if indeed working in vba environment, opposed .net using interop), when set external references (such msxml2, or scripting), might beneficial ...

c++ - why does my cin loop never end? -

in following code, if user inputs not int , program goes infinite loop. why happen, , should fix it? #include <iostream> #include <string> using namespace std; int main() { int i; char str[100]; while (!(cin >> i)) { gets(str); cout << "failure read!" << endl; } cout << "successful read!" << endl; return 0; } clear error state: int main() { int i; char str[100]; while (!(cin >> i)) { cin.clear(); cin.getline(str,100); cout << "failure read!" << endl; } cout << "successful read!" << endl; return 0; }

What is difference between a job and a process in Unix? -

what difference between job , process in unix ? can please give example ? http://en.wikipedia.org/wiki/job_control_%28unix%29 : processes under influence of job control facility referred jobs.

Rails 3: How to trigger a form submission via javascript? -

i have form part submits normal form, don't want set in form_tag :remote => true option. however, under circumstances i'd able have javascript function post form if had been posted :remote => true. need in javascript accomplish this? i tried works, if form has remote => true, remove data-remote attribute submit w/ javascript ie $('input').click(function(){ $('#form').removeattr('data-remote') }); i'm guessing opposite work ie if form doesn't have remote => true do $('input').click(function(){ $('#form').attr('data-remote',true)});

jquery ui - I have one Textbox and inside the textbox i want the text which user cannot be deleted -

i have 1 text box in text inside text box should not deleted , after text cursor has placed ex: textbox: "http://" should available , text in quotations cannot deleted inside textbox , cursor should after quotations. thanks in advance, vara prasad.m add input field: onchange="testedit(this)" and have javascript function this: function testedit(field) { if (field.value.substring(0, 8) != "http://") { field.value = "http://" + field.value.substring(8); } } however, sloppy. best way put http:// in label outside text box. if in text box, should input. putting inside text box, confusing users. good luck.

osx - GTK+ macport on os x -

i installed gtk2 through macport on os x 10.6 when tried use library #include <gtk/gtk.h> it still doesn't recognize , give me compile errors. know how install gtk2? if have pkg-config on system, try: pkg-config --cflags gtk+-2.0

jsf - Icefaces Actionlistener Pass Parameter To Another Page -

i have have icefaces datatable , when user clicks row, pass row's value page. value row's 1 column primary key. planning use how can this? thanks * follow up ** kindly suggest approach following right passing paramter icefaces datatable page. i have following in jsf page <h:commandlink actionlistener="#{bean.setselecteditem}"> and in bean of setselecteditem(actionevent event) method have following code selectedrows.put(datatable.getrowindex(), true); (selectedrows of map<integer, boolean> selectedrows = new hashmap<integer, boolean>(); list<class> selectitems = new arraylist<class>(); (int index = 0; index < datalist.size(); index++) { if (isselectedrow(index)) { selectitems.add(datalist.get(index)); } } newbean.method(selectitems); selectitems.clear(); selectedrows.clear(); corre...

AJAX HTTP protocol response problem with custom server -

i've started add http support custom c# non-webserver application seems work fine firefox/ie/chrome when typing in url directly browser - can see returned text string in page application. the problem when try same httprequest in javascript on web page don't response chrome or firefox (it's fine in ie) - rather status of 0 httprequest object. can see application debug output received request browser , provided response browser must not response send in case exception of ie being less picky. i've swapped between trying different post , requests no avail - eg: request.open('get', url, true); request.onreadystatechange = mycallback; //request.setrequestheader('content-type', 'application/x-www-form-urlencoded'); request.send(null); //tried '' , other data post my simplest server reply have tried is: http/1.1 200 ok\r\n content-length: 20\r\n content-type: text/plain\r\n \r\n ........... i have tried 1.0 instead of 1.1, differ...

c# 3.0 - How to make double[,] x_List in C#3.0? -

i ned implement multi-linear regression in c#(3.0) using linest function of excel. trying achieve =linest(acl_returns!i2:i10,acl_returns!j2:k10,false,true) so have data below double[] x1 = new double[] { 0.0330, -0.6463, 0.1226, -0.3304, 0.4764, -0.4159, 0.4209, -0.4070, -0.2090 }; double[] x2 = new double[] { -0.2718, -0.2240, -0.1275, -0.0810, 0.0349, -0.5067, 0.0094, -0.4404, -0.1212 }; double[] y = new double[] { 0.4807, -3.7070, -4.5582, -11.2126, -0.7733, 3.7269, 2.7672, 8.3333, 4.7023 }; i have write function signature be compute(double[,] x_list, double[] y_list) { linest(x_list,y_list, true, true); < - excel function call. } my question how using double[] x1 , double[] x2 make double[,] x_list ? i using c#3.0 , framework 3.5. thanks in advance actually should be double[,] xvalues = new double[x1.length, x2.length]; int max = (new int[]{ x1.length,x2.length}).max(); (int = 0; < max; i++) { xvalues[0, i] = x1.length > ? x1[i] : 0; xval...

regex - PHP - Email Validation -

possible duplicate: email address validation hello. have function validate email address function isvalidemail($email){ return eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email); } it works domain zones .com , .us etc, contain 2 3 symbols after dot. question is: important include such zones .info or .travel length more 3 symbols , should worry multiple .co.uk etc.? how improve function these needs? there native function in php this, test , see if fits needs: var_dump(filter_var('bob@example.com', filter_validate_email)); p.s: isn't eregi() deprecated?

OpenGL Wrapper in .Net -

this question similar the 1 here . feel answers recommended ( such tao , opentk) not enough because direct port opengl, no oop design, , hard use. what i'm looking .net opengl wrapper written in clear oop principles, easy use ( easy apply textual , lighting, easy debug etc), able rotate 3d diagram mouse ( feature critically missing opengl , tao), , ability export other file formats ( such dwg or dxf or google map file format). any suggestion? both open source or commercial components do. while correct oop wrapper possible, truth need understand how opengl works first (this true of wrapper api, , doubly opengl). since find opengl api hard use, don't understand rendering enough use wrapper api either. most wrappers avoid heavy class frameworks because storing state each object , sending gpu each object inefficient , can kill frame rate. you, programmer, need aware of these pain points, not try hide them behind abstract wrapper layer. library designer can...

Accessing Android native gallery via an intent -

how can user select native gallery in android, rather other gallery-like applications such astro file manager? the following code gives list of activities can select image: intent intent = new intent(); intent.settype("image/*"); intent.setaction(intent.action_get_content); list<resolveinfo> infos = activity.getpackagemanager().queryintentactivities(intent, 0); if this: activity.startactivityforresult(intent.createchooser(intent, "select picture"), request_choose_image); then if user has more 1 application can act gallery (such astro file manager), s/he prompted select 1 of them, no "set default" option. i don't want user prompted choose between them each time, i'd use native gallery. the hacky code sample below uses whitelist test known native gallery names: (resolveinfo info : infos) { if ( 0==info.activityinfo.name.compareto("com.cooliris.media.gallery") || 0==info.activityinfo.name...

c# - Efficiently remove points with same slope -

in 1 of mine applications dealing graphics objects. using open source gpc library clip/merge 2 shapes. improve accuracy sampling (adding multiple points between 2 edges) existing shapes. before displaying merged shape need remove points between 2 edges. but not able find efficient algorithm remove points between 2 edges has same slope minimum cpu utilization. points of type pointf i calculating slope using following function private float slope(pointf point1, pointf point2) { return (point2.y - point1.y) / (point2.x - point1.x); } any pointer on great help. what algorithm using? can think of going through point , each 3 check wherher middle point on vector (or close to) defined 2 other points. need math operation?

javascript - On IE cursor is comming always at start in textarea -

i dealing textarea, , on click of calling 1 replace function remove specified string in textarea, basic operation. expected behavior after clicking on textarea 1) @ first click : it should remove specified string textarea cursor should come @ end of string 2) more 1 click : - cursor should come @ ever user clicks in text area below replace function.... function replace(id,transfromdb) { newstr = $("#"+id).val(); var len = null; if(transfromdb == '') { newstr = newstr.replace(lang.message27,''); newstr = newstr.replace(lang.message28,''); } else { newstr = newstr.replace(lang.message28,''); newstr = newstr.replace(lang.message27,''); } /* change font weight bold. */ $("#"+id).css({"fontweight":"bold"}); $("#"+id).val(newstr); } assume lang.message specified string. it's working above behavior ff. facing issue on ie, keep cursor position @ ...

json - YAJL stream parsing and Twitter streaming API -

twitter streaming api returns blocks of json, yajl parser stops after first one. guess because every block of json independant (i.e: not in global array), yajl has no way of knowing it's not done. how can handle ? here sample of through stream : {"user":{"statuses_count":357,"profile_link_color":"93a644","profile_sidebar_border_color":"eeeeee","followers_count":28,"contributors_enabled":false,"profile_use_background_image":true,"created_at":"fri jun 04 22:45:23 +0000 2010","location":"brazil","verified":false,"profile_background_color":"b2dfda","follow_request_sent":null,"profile_background_image_url":"http:\/\/a3.twimg.com\/profile_background_images\/201416971\/egito.jpg","description":"dare defy status quo!!! free egypt!","is_translator":false,"fa...

html - How do I fix ie 6 hover? -

this code menu: /*menu*/ #menu { text-align: right; margin-left: auto; margin-right: auto; height: 50px; position: relative; z-index: 5; font-size: 0.75em; } #menu ul { margin: 0; padding: 10px 5px 5px 5px; list-style: none; line-height: normal; border: 0px solid #03426a; -moz-border-radius: 6px; background: #f3f4ff; position:relative; width: auto; float:right; } #menu ul li { float: left; } #menu li ul { display: none; } #menu ul li { display: block; text-decoration: none; color: #000; display: block; padding: 0px 15px 5px 15px; text-decoration: none; text-align: center; font-size: 1em; font-weight: normal; border: none; } #menu ul li a:hover { color: #0a67a3; } #menu li:hover ul { display: block; position: absolute; } #menu li:hover li { float: none; font-size: 0.9em; } #menu li:hover { color: #0a67a3; } #menu li:hover li a:hover { color: #000; }...

php - How to create a test environnement on the production FTP -

i'm working on symfony webapp, on production. develop , add/delete/modify functionnality of model, work on laptop, using symfony 'dev' environnemment. i test if work fine, pray little , deploy on prod server ( with risk of data error, when add new not null attributes on model, prod server configuration special stuff, version of php/apache etc. ). the problem setup "staging" server, copy of production server (same database, same configuration apache/php), that, if deployment goes bad, production user stay untouched , working, staging server down. client has 1 ftp available . so, question : can run 2 symfony project, different models, on same ftp ? or there way want ? thank ! a staging server should same production. same versions, same directory structure, etc... clone. however, can still of benefits installing site subdomain (staging.domain.com). check see if host allows subdomains (%99.999 of them do) , install application there.

php - How can I gzinflate and save the inflated data without running it? (Found what I think is a trojan on my server) -

well, not server. friend found , sent me, trying make sense of it. appears php irc bot, have no idea how decode , make sense of it. here code: <?eval(gzinflate(base64_decode('some base 64 code here')))?> so decoded base64, , output ton of strange characters, i'm guessing either encrypted or different file type, when change .jpg .txt , open it. but have no idea how decode , determine source. help? this should safe, still show code: <pre> <?echo(gzinflate(base64_decode('some base 64 code here')))?> </pre> that is, echo instead of eval . if you'd rather in shell, try gunzip after base64 decoding.

Algorithm for converting PCM to IMA ADPCM? -

i have algorithm decompressing ima adpcm http://wiki.multimedia.cx/index.php?title=ima_adpcm , no way re-compress ima adpcm. there simple pseudo code description, or have reverse engineer decompression algorithm? i'm doing because i'm writing server needs receive audio, merge audio tracks together, send out. thanks help. the following open source project pcm ima adpcm encoding c# implementation: https://github.com/flitskikker/imaadpcmencoder

projectgen - Cross platform multi-language project generator? -

i'm looking project generator can build project files various ides visual studio, xcode, sharpdevelop, codeblocks, etc , supports both c/c++ , c# projects. i've looked @ cmake, seems lacks c# support. anyone have suggestions? premake can generate project files visual studio, monodevelop, sharpdevelop, xcode, code::blocks, codelite , plain gnu make, , supports building c#, c++ , c projects tons of platforms unix, linux, osx, windows crosscompiling playstation 3 , xbox 360.

php - curl_multi_exec stops if one url is 404, how can I change that? -

currently, curl multi exec stops if 1 url connects doesn't work, few questions: 1: why stop? doesn't make sense me. 2: how can make continue? edit: here code: $sql = mysql_query("select url shells") ; $mh = curl_multi_init(); $handles = array(); while($resultset = mysql_fetch_array($sql)){ //load urls , send data $ch = curl_init($resultset['url'] . $fullcurl); //only load 2 seconds (long enough send data) curl_setopt($ch, curlopt_timeout, 5); curl_multi_add_handle($mh, $ch); $handles[] = $ch; } // create status variable know when exec done. $running = null; //execute handles { // call exec. call non-blocking, meaning works in background. curl_multi_exec($mh,$running); // sleep while it's executing. other work here, if have any. sleep(2); // keep going until it's d...

ruby socket dgram example -

i'm trying use unix sockets , sock_dgram in ruby, having hard time figuring out how it. far, i've been trying things this: sock_path = 'test.socket' s1 = socket.new(socket::af_unix, socket::sock_dgram, 0) s1.bind(socket.pack_sockaddr_un(sock_path)) s2 = socket.new(socket::af_unix, socket::sock_dgram, 0) s2.bind(socket.pack_sockaddr_un(sock_path)) s1.send("hello") s2.recv(5) # should equal "hello" does have experience this? in common case need use connect , bind both client , server sockets, need 2 different address binding require 'socket' sock_path = 'test.socket' sock_path2 = 'test2.socket' s1 = socket.new(socket::af_unix, socket::sock_dgram, 0) s1.bind(socket.pack_sockaddr_un(sock_path)) s2 = socket.new(socket::af_unix, socket::sock_dgram, 0) s2.bind(socket.pack_sockaddr_un(sock_path2)) s2.connect(socket.pack_sockaddr_un(sock_path)) s1.connect(socket.pack_sockaddr_un(sock_path2)) s1.send("he...

WCF Service with DataContracts VS Default Entity Framework Entities Object -

what pros , cons of using wcf service datacontracts vs entity framework entities object? if generate data contracts using ado.net self tracking entity generator classes in data layer. what best way of using in wcf service? datacontract genrated ado.net self tracking entity generator exchnaged via service or wcf service still use default entity framework objects? main advantage of stes (self tracking entities) implementation of change set. means can return ste web service's operation modify entity (or whole entity graph) , call operation post updated ste web service processing. ef automatically detect changes in ste , process them. this not possible entity framework entities because can track changes if entity attached objectcontext entity detached when returned web service operation. drawback of stes have share assembly defines them among service , clients. stes are not interoperable solutions. at moment projects developed third type of entities - pocos . ...

c# - How do I get a bucket by name in the .Net S3 SDK? -

i'm trying find method using amazon s3 sdk .net bucket name. can find listallbuckets(), don't want have try find response. this worked me: public static s3bucket gets3bucket(string bucket) { try { amazons3 client = amazon.awsclientfactory.createamazons3client(accesskeyid, secretaccesskeyid); return client.listbuckets().buckets.where(b => b.bucketname == bucket).single(); } catch (amazons3exception amazons3exception) { throw amazons3exception; } }

c# - Can I stop service reference generating ArrayOfString instead of string[]? -

Image
i have web method signature this: public string[] toupper(string[] values) i using 'add service reference' in visual studio 2010 generate reference service. unfortunately, process creates proxy class called 'arrayofstring' , uses type instead of expected 'string[]' type. generated async service call signature ends looking this: public void toupperasync(demo.servicereference.arrayofstring values) { } public void toupperasync(demo.servicereference.arrayofstring values, object userstate) { } i have tried options of 'collection' drop down on config service reference form , doesn't seem make difference. this working previously, reason stopped working, perhaps after removing web method service. how generated service reference class use string[] type instead of generated arrayofstring type? on appreciated. edit: @oleg suggests, using asmx web services. i reproduce problem when adding "service reference" asmx style web s...

uitableview - Iphone UITableViewCell CustomCell -

attempting implement "simple" customcell, have normal tableviewcontroller renders fine using normal "default" methods, need implement custom cell uilabel's , uiimage. so created customcell.h, customcell.m, customcell.xib the .h @interface customcell : uitableviewcell <uitextviewdelegate> { iboutlet uiimageview *image; iboutlet uilabel *name; iboutlet uilabel *date; iboutlet uilabel *comment; } @property (retain,nonatomic) iboutlet uiimageview *image; @property (retain,nonatomic) iboutlet uilabel *name; @property (retain,nonatomic) iboutlet uilabel *date; @property (retain,nonatomic) iboutlet uilabel *comment; and .m @implementation customcell @synthesize image; @synthesize name; @synthesize date; @synthesize comment; #pragma mark - #pragma mark view lifecycle - (id) initwithcontroller: (controller *) ctnlr { controllerpointer = ctnlr; return(self); } - (void) setimage:(uiimageview*)image { image = image; } ...

visual studio 2010 - Cannot open include file "d3dx9.h" -

edit: of course, after working on hour posting here, found stupid mistake... i'm getting compiler errors when trying #include <d3dx9.h> in project. i'm receiving "fatal error c1083: cannot open include file: 'd3dx9.h': no such file or directory". i have directx sdk installed (i tried reinstalling no avail). in project properties: vc++ directories set " $(dxsdk_dir)include;$(includepath) " , " $(dxsdk_dir)lib\x86;$(librarypath) " include , library directories respectively configurations—and environment variable %dxsdk_dir% points c:\program files (x86)\microsoft directx sdk (june 2010)\ expected. c/c++ > general settings has $(dxsdk_dir)include listed in additional include directories linker > input > additional dependencies has d3dx9d.lib included debug , d3dx9.lib included release configuration. i am able compile , run tutorial projects directx sample browser. visual studio's intellisense/autocom...

Why this jquery plugin not working with 1.4.2 -

http://plugins.jquery.com/project/semantictabs what means of status - recommended 1.0.x i'm using plugin code http://plugins.jquery.com/files/jquery.semantictabs.js_4.txt then ( i'm using prototype.js onsite) jquery.noconflict(); jquery(document).ready(function(){ $("#mytabset").semantictabs({ panel:'.mypanelclass', //-- selector of individual panel body head:'headelement', //-- selector of element containing panel header, i.e. h3 active:':first' //-- panel activate default }); }); try changing $("#mytabset").semantictabs({ panel:'.mypanelclass', //-- selector of individual panel body head:'headelement', //-- selector of element containing panel header, i.e. h3 active:':first' //-- panel activate default }); to jquery("#mytabset").semantictabs({ panel:'.mypanelclass', //-- selector of individual pan...

Crystal Reports dynamic parameters values -

i have crystal report dynamic parameter (for example, linked on table countries in datebase). how can programmatically allowed values parameter (list of countries)? static can default values using : reportdocument rd = new reportdocument(); rd.load(reporthpath); rd.parameterfields; // contains params default values collections dynamic parameters has no items in defaultvalues collection. can retrieve existing connections report, can relation between connection , dynamic parameters? it's not possible in crystal reports. it's better not use dynamic parameter field; make report unnecessary slow. instead convert them static parameter fill default values code; that's faster plus know accepted values are.

c# - How to map a Value Object in Entity Framework 4 -

i want map value object in entity framework 4 in nhibernate use component-class (nested in ar). how do this? there 2 ways know of. easiest use complextype , cannot have key. more difficult way use poco setters marked private ( example ) , key, allow persist separate database table. (or can kinda mix 2 , former private setters, suppose.)

html - Putting images with options in a dropdown list -

i trying insert images in drop down list. tried following code not working. best way achieve this? <select> <option value="volvo"><img src="a.jpg"height="15" width="15" border="0"align="center">volvo</option> <option value="saab"><img src="b.jpg"height="15" width="15" border="0"align="center">saab</option> <option value="mercedes"><img src="c.jpg"height="15" width="15" border="0"align="center">mercedes</option> <option value="audi"><img src="d.jpg"height="15" width="15" border="0"align="center">audi</option> </select> this code work in firefox: <select> <option value="volvo" style="background-image:url(images/volvo.p...

ios - Show an image in the alert body of a local notification -

i using local notifications, want put image in message body of alert. how can that? i searched same question . , found can't customize uilocalnotification , handled in application:didreceivelocalnotification: showing custom uialertview .

c# - Possible to inject resource files into .net assembly? -

there's .net program students i've been messing around in reflector , reflexil, doesn't can work resource files. want replace default background custom one. how feasible this? i've tried exporting assembly c# project , maybe rebuilding resource files swapped, few classes won't decompile right when exporting , crashes reflector when try view full source code inside reflector (after clicking 'expand methods') what type of applicaiton it? winforms, wpf, silverlight, web? can ildasm round triping. if let me know type of app i'll post steps need take.

Testing scalability and performance for Silverlight 3.0 -

we have silvelright application need test scalability, best tool that? since silverlight client-only, want test web server , web services. you need make sure: you can serve .xap files static files expected visitors any web service calls load tested, along database any existing test tools can used this, no need focus on silverlight part of equation.

ios - iPhone core data preset -

what best way initialize core data database content. iphone app have static database products (data , images). how/where store images, how pre-populate database? here did: create database inside iphone app i created model in xcode , query against database (this creates database) my static data csv file use ruby script read csv file use ruby gem sqlite3 insert data database copy project alternative: store csv/xml file containing data inside app parse on startup , create nsmanagedobjects tools/resources: base software editing/viewing sqlite3 database database location: i'm afraid don't remember on top of head when use simulator application built , copied directory. think path application this. database depending on how setup in documents folder. ~user/library/application settings/ios simulator/<version>/<app id>/

java - jpanel with image in background -

i have simple doubt, need replace this: panel[1].setbackground(color.red); for image, want avoid new jlabel image, because tested , have label inside panel pushed below background panel shows 2 approaches. 1 involves custom painting, other involves using jlabel. approach use based on requirement. custom painting more flexible little more complicated.

silverlight - In a xaml file, how can I use a event handler from another cs file? -

for example, have button click event in xaml file: < button x:name="buttonfindcoordinate" content="map coordinate" click="buttonfindcoordinate_click" /> to knowledge, buttonfindcoordinate_click event handler must function code behind cs file. there way can reference event handler cs file in xaml file (for example, button aa.xaml file, , have event handler function saved in bb.cs)? how can write code? thanks, wei i better practice extract logic of handler separate class have both click handlers call same method. for example in a.xaml.cs private void buttonfindcoordinate_click(object sender, eventargs e) { string postcode = coordinatefinder.findpostcode(txtbuttonfind.text); } and b.xaml.cs private void otherbutton_click(object sender, eventargs e) { string postcode = coordinatefinder.findpostcode(txtsomeotherfield.text); } and coordinatefinder class like. public class coordinatefinder { public static stri...

language agnostic - Are 0 bytes files really 0 bytes? -

i have simple question. when create file, let's "abc.txt" , leave blank. os show file 0 bytes size , takes 0 bytes on disk. if save 100 of these 0 bytes file folder, os folder's total size 0 bytes. this may sound logical because there nothing in file. should not these files take @ least few bytes in storage device? after all, save somewhere , named something. shouldn't file's name , possibly other headers @ least takes space? no, still occupy few bytes on file system. otherwise implement neat file-system stored in terms of filenames on empty files. to me boils down matter of definition. either " size of file " refers the size of content of file , or refers "difference" makes in terms of free bytes on underlying file system (that is, size of content (rounded closest block- or cluster-size) + bytes used it's inode ).

jquery - Testing to see if a text string is part of a variable -

i'm setting variable contents of h1 tag on site. want write if statement tests see if there specific word inside h1 tag. need set dropdown based on title of form. so, have html. <div id="booking-details"><h1>this los angeles</h1></div> here jquery: var city = $('#booking-details h1').text(); if (city.text().indexof('los angeles') >= 0)) {alert("this city los angeles")}; i'm getting syntax error , not quite sure how pull index of text variable. thanks in advance help. you using text() twice, do: var city = $('#booking-details h1').text(); if (city.indexof('los angeles') >= 0)) {alert("this city los angeles")}; or: var city = $('#booking-details h1'); if (city.text().indexof('los angeles') >= 0)) {alert("this city los angeles")};

c# - Debug .NET Framework's source code only shows disassembly in Visual Studio 2010 -

i'm trying debug .net framework's source code using visual studio 2010 professional. followed steps described in raj kaimal 's post, must doing wrong since code i'm getting see disassembly code: alt text http://jdecuyper.github.com/images/so/vs2010debugframework.jpg as can see in image, go source code , load symbols options disabled. nevertheless, symbols downloaded microsoft's server since can see them inside local cache directory. the code i'm debugging goes follow: var wr = webrequest.create("http://www.google.com"); console.writeline("web request created"); var req = wr.getrequeststream(); console.read(); when hit f11 step first line of code, window pops looking "webrequst.cs" file inside "f:\dd\ndp\fx\src\net\system\net\webrequest.cs" not exists on machine. what missing? in project properties, target .net framework 4.0. had same issue when compiling .net 3.5.

c# - Regex modification -

i absolutely stupid when comes regex. have been trying modify following expression match urls begin www. matches urls begin http, ftp, , https not plain www. have not had success on own. appreciated. regex.ismatch(text, @"(^(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?)") thanks in advance! make this... (http|ftp|https):\/\/ into this... ((http|ftp|https):\/\/|www\.)

concurrency - Is JavaScript guaranteed to be single-threaded? -

javascript known single-threaded in modern browser implementations, specified in standard or tradition? totally safe assume javascript single-threaded? that's question. i'd love “yes”. can't. javascript considered have single thread of execution visible scripts(*), when inline script, event listener or timeout entered, remain in control until return end of block or function. (*: ignoring question of whether browsers implement js engines using 1 os-thread, or whether other limited threads-of-execution introduced webworkers.) however, in reality isn't quite true , in sneaky nasty ways. the common case immediate events. browsers fire these right away when code cause them: <textarea id="log" rows="20" cols="40"></textarea> <input id="inp"> <script type="text/javascript"> var l= document.getelementbyid('log'); var i= document.getelementbyid('inp'); i.o...

asp.net - Session variable getting lost using Firefox, works in IE -

i setting session variable in httphandler, , getting value in page_load event of aspx page. i'm setting using public void processrequest(httpcontext context) { httppostedfile file = context.request.files["filedata"]; context.session["workingimage"] = file.filename; } (and before suggests check validity of file.filename, same problem occurs if hard-code test string in there.) it's working fine in ie, in firefox session variable not found, getting "object reference not set instance of object" error in following code: protected void page_load(object sender, eventargs e) { string loc = session["workingimage"].tostring(); } has encountered problem - , come means passing session variable? this httphandler? if chance has flash, , flash making request, interested in reading the flash cookie bug . basically, flash forwards ie cookies. the easist fix call correctcookie @ appli...

stl - Do I need to check capacity before adding an element to a vector in c++? -

i newbie c++ stl vectors sorry silly questions in advence. :) in program, have vector needs store unknown number of elements. have check if vector has achieved max_size before adding new element ? c++ compiler throw exception automatically when program tries add elements full vector ? thank much, cassie if std::vector has reached max size, attempting insert element result in underlying allocator throwing std::bad_alloc exception. note, however, maximum size vector typically very, large (e.g., maximum value can represented size_t divided size of element type), unlikely, if not impossible, reach maximum size before run out of contiguous memory in vector can stored.

c# - Is it possible to wrap specific classes or methods and assign them to a thread? -

i have xaml form 2 independent features threaded out of main xaml execution thread: 1.) timer control ticks up, , 2.) implement pause button can freeze set of procedural set of activities , clicking on pause button again resume. when start form, entire app freezes. because of can't interact btnpause control. got timer class work, (lbltimer) updates in chunks, or whenver looks cpu isn't busy on main thread. i tried create class "task" wraps class or method in own thread can control. automation.task automationthread = new automation.task(); automation.task timerthread = new automation.task(); later on, attempted create stopwatch class , assign timerthread can manage independently. automation.watchtimer stopwatch = new automation.watchtimer(lbltimer, timerthread); class task { private manualresetevent _shutdownflag = new manualresetevent(false); private manualresetevent _pauseflag = new manualresetevent(true); thread _thread; ...

jQuery UI Nested Sortable, sending additional data -

another question relating jquery ui nested sortable 1.2.1 . we call function this: $(document).ready(function(){ $('ol.sortable').nestedsortable({ disablenesting: 'no-nest', forceplaceholdersize: true, handle: 'div', items: 'li', opacity: .6, placeholder: 'placeholder', tabsize: 25, tolerance: 'pointer', toleranceelement: '> div' }); i thinking how can send additional information through this, like: $(document).ready(function(){ $('ol.sortable').nestedsortable({ disablenesting: 'no-nest', forceplaceholdersize: true, handle: 'div', items: 'li', left_val: '<?=$lft?>', root_id: '<?=$id?>', opacity: .6, placeholder: 'placeholder', tabsize: 25, tolerance: 'pointer', toleranceelement: '> div' }); idea use 3 variables, left_val, root_id , holder in following fashion in toarray function. var left = this.left_val; var root_id = this.r...

c++ - Real time physics with MPI -

i considering working on rigid body parallel physics engine, mpi, own project. have experience serial engines. far, couldnt find existing projects of type, enyone knows such things? i know mpi not best choice real time physics, lots of time lost on duplicating data send/rcv between nodes. planning on running on non shared memory machine though. does sounds worth doing? thanks if can fit job available memory gpu (either cuda or opencl) may way go. mpi isn't made responsiveness, exotic low latency interconnects message passing slow. unless it;'s changed since day lot of code polling nodes , waiting reply doesn't help.

iphone - Global Variable problem -

i new in iphone.i use flag variable play songs in avaudio player songs handeled flag variable.we have 2 tabs in tab bar , want if song playing on other tab song info show.if use flag variable syncronize song info song.but can't access value of flag on song info tab.i import global file in song info file. please me 1 through define global integer var can access in project. global variables evil. complexity of app grows cause problems impossible track down. there few ways handle this. create bool property in app delegate , reference property referencing app delegate. common way implement type of functionality. create custom singleton object hold variables. access variable calling singleton. use 1 large complex data. save value in user defaults calling +[nsuserdefaults standarduserdefaults] in case think (3) best because you're trying save application state instead of user data. application state information belongs in user defaults. particularly handy wh...

sql - Fill in missing values in a SELECT statement -

i have table 2 columns, customer id , order. let's have in total order ids 1,2,3,4 all customer can have 4 orders, below: 1234 1 1234 2 1234 3 1234 4 3245 3 3245 4 5436 2 5436 4 you can see above 3245 customer doesn't have order id 1 or 2. how print in query output like: 3245 1 3245 2 5436 1 5436 3 edit: don't have order table, have list of order's can hard code in query(1,2,3,4). select c.id, o.order ( select 1 order union select 2 order union select 3 order union select 4 order ) o cross join ( select distinct id customer_orders ) c not exists ( select null customer_orders ci ci.id = c.id , ci.order = o.order ) if have customers table, becomes more simple: select c.id, o.order ( select 1 order union select 2 o...

javascript - How to disable Cufon on certain elements? -

i use cufon accross our site similar cufon.set('fontfamily', 'din medium').replace('h1'); single h1 tag cufon disabled, without changing h1 tag other tag, must remain is. i can add classes etc h1 tag if required, , can html/css/js not changing actual tag. anyone know if possible , if how? thanks in advance, shadi depending on selector engine use, can: add class exception h1 element you can use :not selector apply cufon h1's don't have aforementioned class (with jquery , classname 'clean' cufon.replace('h1:not(.clean)');

perl - Use data structure references more commonly -

i have been reading of perl513*delta files , have seen of new features coming perl 5.14. beginning perl 5.13.7 many of array/hash functions work on array/hash refs well . while seen syntactic sugar, or perl doing expect, wonder, will/should change paradigm of declaring data structures in perl? known caveat breaks compatibility eariler perl's, arguements , against using anonymous structures primarily? for example: #!/usr/bin/env perl use strict; use warnings; use 5.13.7; $hashref = { english => 'hello', spanish => 'hola', french => 'bon jour' }; foreach $greeting (keys $hashref) { $hashref->{$greeting}; #use since need later version anyway } rather more traditional way using named hash ( %hash ). p.s. if seen augmentative can change cw, curious hear perspectives. the ability use array , hash functions on references syntactic sugar , need not impact way work first level plural structures. there several reasons this...

c# - How to set the page number at runtime in datapager -

i've created links in listview attached datapager. when user clicks link see content left datapager changes page page 1. you need add querystring field indicating page number each of links. need set querystringfield attribute of datapager control equal name of querystring field. for example: <asp:datapager id="dpitems" runat="server" pagedcontrolid="lvitems" pagesize="10" querystringfield="pagenumber"> from msdn: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datapager.querystringfield.aspx if want paging math yourself, can set startrowindex property @ runtime. can't, however, set page directly. eg., if displaying 10 records per page, , want display second page, set mydatapager.startrowindex = 20 in runtime code. alternatively, datapager can handle math automatically , generate paging controls when set datapager's fields , set querystringfield value. can either have use ne...