Posts

Showing posts from July, 2011

linux - Can I abort the current running bash command? -

is possible manually abort running bash command? so, example, i'm using 'find' it's taking ages... how manually stop it? some things won't respond ctrl+c ; in case, can ctrl+z stops process , kill %1 - or fg go it. read section in man bash entitled "job control" more information. it's helpful. (if you're not familiar man or man pager , can search using / . man bash inside /job control enter start searching, n find next match right section.)

How do I Ignore the build folder in NetBeans 'Find In Projects'? -

anyone know how ignore build folder when doing 'find in projects' on netbeans (v6.9.1). currently search results pane shows results src folders build folder if project contains lot of jsp files example, many results duplicated... i think i've figured out how ignore build folder of projects when doing 'find in projects' in netbeans 6.9.1: go tools->options-miscellaneous . click files tab. in files ignored ide , edit ignored files pattern regular expression , include build folder. example, on system added build thus: ^(cvs|sccs|vssver.?\.scc|#.*#|%.*%|_svn|build)$|~$|^\.(?!htaccess$).*$ click ok save options , close dialog. (nerd note: took me 1 year day figure out!)

compile souce code of android in cygwin -

i have several problem: if modify email app ,if can use cygwin compile.if yes how compile,if no if can compile in vmware workstation ubuntu. if modify framework resources,if can use cygwin compile.if yes how compile,if no if can compile in vmware workstation ubuntu. how combile whole source code ,if can use cygwin or vmware workstation ubuntu every 1 can give me guide or link , on 1.)the email app java app every other app. don't need cygwin, can make android apps on windows. 2.) framework resources? mean android source code? you'll have cross compile whatever architecture phone runs on. extremely non trivial, , not possible in cygwin.

unit testing - How to export a ddl script from an Oracle 10 schema to create tables and constraints in H2-database? -

we use h2 in-memory database automated testing of our web-applications. use oracle 10 our production , development environments. so idea duplicate table structure in h2 test-database in our oracle dev-database. it there easy way extract ddls oracle 10 schema (tables , constraints) executed against h2 database? i'd have ask 'proving' if test environment using different database engine actual implementation. example h2 has date datatype date. in oracle date datatype stores time well. if decide go route, rather trying convert oracle ddl syntax h2 you'd better off designing data structures in modelling tool , using 'source of truth'. tool should capable of exporting / creating ddl in both oracle , h2 formats. tools should support oracle, though h2 might little trickier.

iphone - Best way to store a 'time' value -

my class needs 2 properties: starttime , endtime . best class use? know there nsdate, need store specific time (something in between 00:00-23:59), don't need date. elegant solution here? nstimeinterval enough this. it stores time value in seconds double. eg. 5 mins = 300.0

ios - HTML5 video for iPhone / iPad. How to detect connection speed? -

i need stream video in safari iphone/ipad best possible quality. i created 2 video files: 1 in low-quality slow 3g speed, 1 in hi-quality wifi broadband streaming. noticed apps (youtube example) able detect if mobile device running 3g or wifi, , select small sized video rather hi-quality video. now dom / javascript code, $v value replaced php , contains video filename: <video id="thevideo" src="streaming/video_<?=$v ?>.m4v" width="600" height="360" width="640" height="360" preload="preload" controls="controls" autoplay="autoplay"> flowplayer/video<?=$v ?>.m4v </video> <script type="text/javascript"> var myvideo = document.getelementbyid("thevideo"); myvideo.load(); myvideo.play(); </script> can write in javascript / webkit able detect connection mode? thanks all. i assuming in own application: you use apple&

configuration - WPF Validation Message in Xml -

i have wpf application displaying field validation messages implementing idataerrorinfo interface. working well. what want break out validation messages separate xml file validation message key value pairs can stored outside of code , can maintained possibly end (super)user. i thinking of having method like: private void validaterequiredfield<t>(ref t field, string fieldname) { string error = null; if (equals(field, null) || (field string && (string.isnullorempty(field.tostring()) || field.tostring().replace(" ", string.empty).length == 0) ) || (field int && int.parse(field.tostring()) == 0) ) { error = getvaluefromconfig(fieldname); } setfielddataerror(fieldname, error); } is best way store these key value pairs in xml file? seem remember there used microsoft configuration appl

binding - JQuery bind function to multiple objects -

how can edit code below bind function both mylink , mybutton . if (section === x) { mybutton = $("#a"); mylink = $("#b"); } else { mybutton = $("#c"); mylink = $("#d"); } mylink.click(function(e) { e.preventdefault(); showmydialog(); }); if (section === x) { $("#a,#b").click(onclick); } else { $("#c,#d").click(onclick); } function onclick(e) { e.preventdefault(); showmydialog(); });

wpf - Async Calls to Entity Framework -

anyone found way make asynchronous calls db via entity framework? use background worker thread? wpf application. i know in ria services there loadcompleted event not seem exist in entity framework's object context. thanks! i've written blog post async calls via commanding in wpf application http://devblog.terminto.com/2010/11/03/threading-as-command-in-mvvm/ at work use same technique , calls db (ef4). is useful, or asking more entity framework-specific async methods?

How to get asp.net website product name and version? -

hopefully easy 1 - though don't seem have luck googling following: usually in asp.net web application write - my.application.info.productname or my.application.info.version , i'm looking @ older asp.net web site , doesn't have application option. does know equivalents? i asked similar question: how should version asp.net web site project? my solution use assembly version of assembly included web site.

How to display via JQUERY more JSON data -

i'd code http://af-design.com/blog/tag/autocomplete/ use json. i've code works fine dont how solve task , event use. i'd insert text fields values json response. user started typing, clicked on item , info should inserted text fields. when user changed item in autocomplete data must updated also. // $('#infogistype').val(item.gis_type); // $('#infogislocationid') val(item.location_id); $('#gisname').autocomplete({ source: function(request, response) { $.getjson("autocomplete.php", { term: request.term }, function(result) { response($.map(result, function(item) { return item.name; })); }); }, how can it? [{"name":"kiev","location_id":"3","parent_id":"0","gis_type":"region"}, {"name":&q

java - How to design a private/final method available for mocking? -

this class have test: public class downloader { public string download(string uri) { httpclient client = this.gethttpclient(); client.seturi(uri); return client.get(); } private httpclient gethttpclient() { httpclient client = new httpclient(); // + config return client; } } very simple. want test behavior when gethttpclient() throws exception. however, can't mock method, since private . common practice in such situation? i make httpclient field of class set on construction (via interface). have ability create mock httpclient can throw exception during test if want, e.g.: public class downloader { private ihttpclient client; public downloader(ihttpclient client) { this.client = client; } public string download(string uri) { this.initialisehttpclient(); client.seturi(uri); return client.get(); } private httpclient initialisehttpclient() { // + config } } then call constructor real http

c# - How can I get the processor architecture of an assembly dll? -

can processor architecture loading dll programmatically in c#? is there class can this? i need wether dll x86, x64, msil etc.. assuming looking @ .net assemblies, can use corflags.exe @ header of image. this blog post explains usage determing how read results. excerpt: usage: corflags.exe assembly [options] if no options specified, flags given image displayed. ... here each component of header means: version : contains version of .net redist binary built. clr header : 2.0 indicates .net 1.0 or .net 1.1 (everett) image while 2.5 indicates .net 2.0 (whidbey) image. corflags: computed or’g specific flags indicate whether image ilonly, bitness etc. , used loader. ilonly: managed images allowed contain native code. “anycpu” image shall contain il. 32bit: if have image contains il still might have platform dependencies, 32bit flag used distinguish “x86” images “anycpu” images. 64-bit images distinguis

Split DateTime to Date and Time in ASP.NET MVC -

Image
i have read through scott hanselman's post on topic. found another article seems simpler approach. second of decided try. however, first portion in creating editortemplates not working me. copied datetime.ascx , timespan.ascx has author had them written. split fields in view. <div class="editor-label"> <%= html.labelfor(model => model.leaverequest.dateofleave)%> </div> <div class="editor-field"> <div class="date-container"> <%= html.textboxfor(model => model.leaverequest.dateofleave.date)%> </div> <div class="time-container"> <%= html.textboxfor(model => model.leaverequest.dateofleave.timeofday)%> </div> <div class="clear"> <%= html.validationmessagefor(model => model.leaverequest.dateofleave)%> </div> </div> the problem

ruby on rails - Confusion with super -

override to_xml. what difference between these codes. can explain proper example ? 1. def to_xml(options = {}) options.merge!(:methods => [ :murm_case_name, :murm_type_name ]) super end 2. def to_xml(options = {}) super options.merge!(:methods => [ :murm_case_name, :murm_type_name ]) end tl;dr: super behaves in unexpected ways, , variables matter, not objects. when super called, it's not called object passed in. it's called variable called options @ time of call. example, following code: class parent def to_xml(options) puts "#{self.class.inspect} options: #{options.inspect}" end end class originalchild < parent def to_xml(options) options.merge!(:methods => [ :murm_case_name, :murm_type_name ]) super end end class secondchild < parent def to_xml(options) options = 42 super end end begin parent_options, original_child_options, second_child_options = [{}, {}, {}] parent.ne

c# - Live Tile updates -

how create live tile windows phone 7? wondering because have text updates on live tile once per 1-5 minutes user glance at. timing possible? to update tile can use push notification or shelltileschedule . the level of frequency talking technically possible puch notifications not schedule. highest frequency can use schedule hourly. i recommend reviewing updating @ frequency level talking though. is data going update often? is user realisitically going checking phone often? if need update user when data changes alternatives better suited. e.g. sms, email, automated call or toast notification. you should consider updating less frequently. people don't check phone 24 hours day. serious if data user saw hour old?

wpftoolkit - WPF DataGrid doesn't shrink when column width shrinks -

i using datagrid in wpf , want shrink fit width of columns. nicely initial rendering. when resize column make wider grid grows well. if resize column make narrower again white space on right side of column (and can see column header grey area extended beyond columns. i have data grid shrink width columns don't white space on right. have tried debug code , far can see problem in datagridcellspanel, can't see anyplace fix width measurement. any appreciated. i had problem while , getting annoyed made ugly fix it. it's not pretty, gets job done. first, problem when horizontal scrollbar invisible we're gonna need reference it. code have run once datagridcolumns have been loaded (in case, in xaml, loaded event) , doesn't take adding/removing of datagridcolumns consideration that's easy fix. <datagrid name="c_datagrid" loaded="c_datagrid_loaded" ...> <datagrid.columns> <datagridtextco

bytecode manipulation - java disassemble reassemble -

say want take java class file, disassemble it, tweak java bytecode output, , reassemble again. i need rename symbol in constant pool table. don't have access source code, , using decompiler seems overkill this. i'm not trying optimize - java fine job @ that. is there... simple way this? i've found several tools either disassembly or reassembly, none both; or no pairs of tools seem use same format representing bytecode in text. did check asm api? here code sample (adapted official documentation) explaining how modify class bytecode: classswriter cw = new classwriter(); classadapter ca = new classadapter(cw); // ca forwards events cw // ca should modify class data classreader cr = new classreader("myclass"); cr.accept(ca, 0); byte[] b2 = cw.tobytearray(); // b2 represents same class myclass, modified ca then b2 can stored in .class file future use. can use method classloader.defineclass(string,byte[],int,int) load if define own classloader.

.net - Why does DataTable.Rows not have a .Where() method? -

i syntax offered .where() method available many collections. however, i've noticed conspicuously absent collections. i'm sure has interface being implemented or not implemented, beyond that, know why don't have .where() method on datatable.rows datarowcollection implements ienumerable , not ienumerable<datarow> . an extension method exists - datatableextensions.asenumerable - "fix" this. call table.cast<datarow>() enumerablerowcollection returned asenumerable has bit more functionality on it. so can write: var query = row in table.asenumerable() ... select ...; there other useful extension methods in datarowextensions , notably field , can write: var query = row in table.asenumerable() row.field<int>("age") > 18 select row.field<string>("name");

How to disable completely Hibernate caching? (with Spring 3, Hibernate with annotations) -

java app asks mysql server query every 10 seconds. manually insert table new row. , hibernate can't find it. when manually remove row, hibernate shows row exists. suggest because hibernate caching. there way disable @ all? thank you! do mean first-level cache or second-level cache? having hibernate second-level cache such ehcache caches entities correspond rows in same table modify manually cause behaviour describe. first-level cache not cause behaviour, , don't think can disable it, anyway. to disable hibernate second-level cache, remove hibernate configuration file, hibernate-cfg.xml , lines refer second-level cache. example: <!-- enable second-level cache --> <property name="hibernate.cache.provider_class"> net.sf.ehcache.hibernate.ehcacheprovider </property> <property name="hibernate.cache.region.factory_class"> net.sf.ehcache.hibernate.ehcacheregionfactory </property> <property name=

winapi - Embed a file as unicode (WCHAR) into a resource -

i have text file i'd embed within resource in win32, unicode characters - is, each character takes 2 bytes. how can this? file contains ascii characters. is there indication or flag whether or not file unicode file? i have resource.rc : file file_type "text.txt" when loaded @ runtime, each character takes 1 byte. rc not interpret contents of files embedded in way. sure file saved unicode? if not, can save file unicode notepad (file -> save as, choose encoding = unicode).

c++ - How to generate compile time errors? -

i able this: void f(int*p = nullptr) { if (!p) { //here have msg displayed during compilation warning possibly } } the correct answer is: you're trying won't ever work.

ASP.NET EditorTemplate DropdownList -

every time add new app creates new appcategory . screwing somehow code first entity framework objects public class appcategory { public int id { get; set; } public string name { get; set; } public icollection<app> apps { get; set; } } public class app { public int id { get; set; } public string name { get; set; } public appcategory category { get; set; } } editor template (i love make 1 foreign key editortemplate) @inherits system.web.mvc.webviewpage @html.dropdownlist("category", lig2010redesignmvc3.models.repo.getappcategoriesselect()) and of course repository public static ienumerable<selectlistitem> getappcategoriesselect() { return (from p in getappcategories() select new selectlistitem { text = p.name, value = p.id.tostring(), }); } public static icollection<appcategory> getappcategories() {

python - How can I force urllib2 to time out? -

i want to test application's handling of timeouts when grabbing data via urllib2, , want have way force request timeout. short of finding very slow internet connection, method can use? i seem remember interesting application/suite simulating these sorts of things. maybe knows link? i use netcat listen on port 80 of local machine: nc -l 80 then use http://localhost/ request url in application. netcat answer @ http port won't ever give response, request guaranteed time out provided have specified timeout in urllib2.urlopen() call or calling socket.setdefaulttimeout() .

javascript - Call Ajax on unload if user clicks "OK" -

i'm designing rather long form auto-save every couple minutes (i.e., using ajax, form data inserted or updated mysql database). however, if user decides exit page before submitting form, want make sure delete row inserted database. do-able if user clicks link or form's cancel button. i'm concerned happens when user: 1) closes page, 2) reloads page, or 3) hits browser's (or forward) button. know how use unload event create confirmation dialog asking user confirm want leave page. don't know how make ajax call (to delete row database) if user clicks ok ("press ok continue"). there way call function if user clicks ok button during unload event? window.onbeforeunload = function() { if ($('#changes_made').val() == 'yes') //if user (partially) filled out form { return "are sure?" if (/*user clicks ok */) //what should if statement evaluate here? { //make ajax ca

xcode - Best way to design iPhone interface -

in terms of interface design in interface builder or photoshop, do? ie. setting gradients backgrounds, using pngs icons. whats easiest way sort of stuff? through code or what? i use mockapp .

browser - Loading jQuery and related stuff from Google -

is faster loading host? because when open website loads stuff other sites, browser has make new connections. wouldn't faster load stuff site browser connected to? when browser downloads html/css/js/img files site can load few @ time (some two, 8, believe). per domain though. by using google cdn have additional simultaneous download, greater chance of file being cached, plus using server closer end user. personally, our load times have improved using google cdn of jquery.

Is there a Linux API for gathering information about mmap'ed regions? -

i know can read file /proc/$pid/maps , wondering if there api process memory mappings. there no api in kernel information in 1 syscall. universal way read , parse /proc/self/maps file.

c# - How can I prevent appendChild() from adding the xmlns="" -

here snippet of code. filtertext = httputility.urldecode(filtertxt.value.tostring()); xmlwritersettings settings = new xmlwritersettings(); settings.indent = true; textwriter tw = new streamwriter("d:\\filtertest.rdl"); tw.writeline(filtertext); tw.close(); xmldocument reportrdl = new xmldocument(); reportrdl.load(reportfile); nms = reportrdl.namespaceuri; xmlnodelist fieldsnode = reportrdl.getelementsbytagname("dataset"); //xmlelement xoo = reportrdl.createelement("filters", nms); //reportrdl.appendchild(xoo); foreach (xmlnode fields in fieldsnode) { // second document merge (the new filter file) xmldocument filterrdl = new xmldocument(); filterrdl.load("d:\\filtertest.rdl");

Accessing contact information of a facebook app user -

i have access_token facebook application. there way can contact information(phone-number) of user of facebook application? below url returns me public information name, location, education etc.. not contact information https://graph.facebook.com/me?access_token=xxxx.... thanks in advance!! you can't phone number graph api. can email though if have email extended permission: http://developers.facebook.com/docs/authentication/permissions . if whitelisted app believe can send facebook messages through api.

oop - Similar logic but different classes (avoid duplication) -

i've got 4 similar class structures generated xsds, each 1 different version of api. the thing is, have classes operate on these different class structures, deal of code same throughout structures. can't have interfaces each class since classes generated xsds. yet want remove duplication codebase... what oo solution here? thanks. i use little object composition. define class holds shared functionality , keep instance member each of generated classes. try minimize amount of mutable state keep in class can test easier.

Ruby: importing two modules/classes of the same name -

when system requires 2 classes or modules of same name, can specify mean? i'm using rails (new it), , 1 of models named "thread". when try refer class "thread" in thread_controller.rb, system returns other constant of same name. <thread.rb> class thread < activerecord::base def self.some_class_method end end <thread_controller.rb> class threadcontroller < applicationcontroller def index require '../models/thread.rb' @threads = thread.find :all end end when try thread.find(), error saying thread has no method named find. when access thread.methods, don't find some_class_method method among them. any help? (and don't bother posting "just name model else." it's not helpful point out obvious compromises.) you put app own namespace. <my_app/thread.rb> module myapp class thread end end

How to fix a Python elif? -

okay have below code performing don't want do. if run program ask "how you?" (obviously), when give answer question applies elif statement, still if statement response. why this? talk = raw_input("how you?") if "good" or "fine" in talk: print "glad here it..." elif "bad" or "sad" or "terrible" in talk: print "i'm sorry hear that!" the problem or operator not want here. you're saying if value of "good" true or "fine" in talk . value of "good" true, since it's non-empty string, why branch gets executed.

c# - Thread local storage -

what best way store variable local each thread? you can indicate static variables should stored per-thread using [threadstatic] attribute: [threadstatic] private static int foo;

c++ - Deallocating memory -

for project have implement bitset class. code far is: header file #ifndef bitset_h_ #define bitset_h_ #include <string> #include <cmath> using namespace std; // container class hold , manipulate bitsets class bitset { public: bitset(); bitset(const string); ~bitset(); // returns size of bitset int size(); // sets bitset equal specified value void operator= (const string); // accesses specific bit bitset bool operator[] (const int) const; private: unsigned char *bitset; int set_size; // sets bitset equal specified value void assign(const string); }; #endif /* bitset_h_ */ source file #include "bitset.h" bitset::bitset() { bitset = null; } bitset::bitset(const string value) { bitset = null; assign(value); } bitset::~bitset() { if (bitset != null) { delete[] bitset; } } int bitset::size() { return set_size; } void bitset::operator= (const string value) { ass

Tracing Python warnings/errors to a line number in numpy and scipy -

i getting error: warning: invalid value encountered in log from python , believe error thrown numpy (using version 1.5.0). however, since calling "log" function in several places, i'm not sure error coming from. there way numpy print line number generated error? i assume warning caused taking log of number small enough rounded 0 or smaller (negative). right? usual origin of these warnings? putting np.seterr(invalid='raise') in code (before errant log call) cause numpy raise exception instead of issuing warning. give traceback error message , tell line python executing when error occurred.

Specifying an alias to column names in Django -

i querying auth_users table of django return users matched search criteria. users = user.objects.filter( q(first_name__icontains = name)| q(username__icontains = name) | q(email__icontains = name) | q(last_name__icontains = name) ).values( 'id', 'username', 'first_name', 'last_name', 'email' ).order_by('first_name') i wondering if it's possible me change name of 'first_name' 'firstname'? can in sql [ select first_name firstname auth_users ]; so can access using firstname instead of first_name thanks i create translation layer between 2 namespaces. since using django orm , javascript code legacy assume want in python. def translate(js_column_name): return { 'firstname': 'first_name', }.get(js_column_name, 'string return when not found') using translation function create keyword arguments in dictionary , pass q functi

call function with parameter in jQuery -

when click control id of button1 calls function called getmakes, want able pass parameter it. in case id of control receiving data. doing wrong? $(function () { $('#button1').click(getmakes("'#output'")) $('#buttonclear').click(function () { $('#output').html(''); }); }); function getmakes(myvar) { $.ajax({ type: "post", url: "webservice.asmx/dbaccess2", data: "{}", contenttype: "application/json; charset=utf-8", datatype: "json", success: function (msg) { var response = msg.d; $.each(response, function (index, value) { $(myvar).append(new option(value, index)); }); }, failure: function (msg) { alert('failure'); } }); } oj , jacob have right solution, didn't explain why. code, $('#button1').click(getmakes("'#output'&

rspec - A question in the rails spec test -

today, use factory_girl instead of rails fixtures, problem: after run command "spec spec" done, data resets fixtures, can tell me answer? thank you! if intend use both factories , fixtures in project , not running them through rake tasks: eg rake spec , need make sure doing removal of values db hand. doing grabbing old record in database , think data being reset. can verify using puts inside spec trace number of records in db. puts myrecord.count you can clear values in after or before block. before(:each) factory(:my_model) end after(:each) mymodel.delete_all end if intend use model or factory in other spec files, can add these global before , after blocks in spec helper.

django when edit the data from data base -

i tryong edit data database getting error @ update_user_id more info please @ link u understood please http://www.pastie.org/1301839 it seems didn't set update_user_id key in session. can work around problem using exceptions: try: update_user_id = request.session["update_user_id"] except keyerror: update_user_id = some_default_value or (even better) using request.session.get : update_user_id = request.session.get("update_user_id", some_default_value) the 2 snippets equivalent.

tsql - T-SQL Contains Search and German Umlaut on SQL Server 2008 R2 -

i facing problem on sql server 2008 r2 have use contains search while ignoring german umlaute-letters (ä, ö, ü). for non german speaking developers: german umlaut-letters can represented regular underlying letter (a when using ä) , e. müller same mueller , bäcker same baecker. what want this: when searching "müller" find data containing "mueller" "müller" , when entering "mueller" find entries containing "müller" "mueller". when comparing data using or = append collate german_phonebook_ci_ai. when using contains search full text index not easy. can set accent sensitivity off contains search treats ü-letter u, ä-letter , ö letter o, wont find entries contain oe instead of ö, ue instead of ü , ae instead of ä. setting collation on column "german_phonebook_ci_as" or "german_phonebook_100_ci_as" not seem either. has had same problem before? you should follow these steps: create full-t

svn - unversioned already versioned? -

i deleted of files svn repo. tried recommit files. going fine until nested folders started chuck out message. how overcome this? execute: add error: error while performing action: '/opt/lampp/htdocs/cmsv5/cms/images/breadcrumb' under version control delete remaining (hidden) .svn folders within directories giving trouble. they'll exist in every single nested dir. if that's not problem, sure clean checkout , update before move files directory want commit them. re-add them, , commit. beware of stray .svn folders.

How to write cross-platform C library and link it with iOS app? -

i need lib kind of caching. must cross-platform reuse on linux/windows/ios. how do that? if want this, need put platform specific code inside #ifdef allow code compiled on different platforms. might easier create 1 common c library same across platforms , 3 separate c libraries handle platform specific code. i think code easier read , manage way.

How do I detect if a user is using the Lotus Notes browser? -

we provide web based platform our clients , content doesn't work when viewed through lotus notes internal browser. despite various warnings not opening in lotus, users still doing it. therefore need reliable way detect lotus browser , therefore block , display appropriate message. i can't see user agents in use particular evidence of agent specified , have been advised lotus may spoof this. does know how can detect lotus notes browser? i tried notes browser , got user agent: mozilla/4.0 (compatible; lotus-notes/6.0; windows-nt) granted on notes 6.0.4, imagine internal notes browser still provide accurate user-agent. the problem might be, though, people using integrated internet explorer browser, show version of ie.

email - Set mailer "from" value to smth arbitrary in Rails -

my email address deliver messages noreply@domain.com , when send message with: mail(:from=>'noreply@domain.com', :to=>"somebody@gmail.com", :subject=>"welcome!") from field in gmail shows noreply , have tried using following: mail(:from=>'domain', :to=>"somebody@gmail.com", :subject=>"welcome!", :return_path=>"noreply@domain.com", :reply_to=>"noreplay@domain.com") above returns: 554 message refused. all want from field saying "mydomain" or whatever. how do this? thanks! did try using :from=>'mydomain <noreply@domain.com>' if doesn't work add header key 'from' , value in following format: from_name <from_email>

Why does extJS give me "Ext.Panel is not a constructor" error in Firebug? -

Image
i working through this extjs tutorial type in code firebug, press ctrl-enter , renders you, worked simple example got error: instructions: what happens: what else need example work states in demo? you need have ext-all.js (and maybe ext-base.js ?) loaded in page you're testing work. example isn't working because panel file cannot located. doesn't exist because haven't added it. test ext.panel code in firebug @ api site: http://dev.sencha.com/deploy/dev/docs/ you'll see desired behavior occurs because page has of proper js files loaded. time see message "... not constructor" should indication js file containing object has not been loaded page.

Auto overriding context in javascript functions -

take in consideration code: function a() { alert(this.variable); } b = new function() { this.variable = "abc"; a.call(this); } is there way auto override context instead of using call method? (not working): function a() { var _this = function.caller; alert(_this.variable); } b = new function() { this.variable = "abc; a(); } thanks in advance. if want a have access b 's this , you'll have pass this explicitly, i.e. instead of a() a(this) .

java - Best Practices for GWT services exceptions logging -

i decided add logging system gwt service layer. first of wanted log exceptions thrown layer. had object similar spring's servletdispatcher, calls other services. thought add logging there, realized gwt services wraps checked exceptions in servletresponse , unchecked unexpectedexception. can share experience problem? best way log checked , unchecked exceptions gwt services. i found solution suggests extend remoteserviceservlet , override default exceptions flow. find solution time-consuming. anybode know easier variant? on server side, have subclass of remoteserviceservlet use service implementations. mention seems time-consuming, here's code looks like. once , you're done. @override protected void dounexpectedfailure(throwable t) { t.printstacktrace(system.err); super.dounexpectedfailure(t); } note: don't send system.err , shouldn't either, idea. on client side, use subclass of asynccallback called asyncsuccesscallback. handles onfa

sql server - Invalid Object Error in spite of the Schema being the default Schema for the User -

i've problem while executing select query ssms (sql server 2008).it gives out error saying 'invalid object ' user name: admin defaultschema: s1 table being accessed: employee query1: select * employee query2: select * s1.employee in case query1 fails above said error whereas query2 works fine , fetches values. can me figure issue here. in spite of having s1 default schema user 'admin' still asks me append schema name query executed. thanks. i'm going guess, based on fact user name "admin", user member of sysadmin server role. if true, default schema setting user ignored members of sysadmin role automatically default schema of dbo. see documentation alter user further details.

objective c - Using addSubView or presentModalViewController in a standard method with paramaters? -

i'm trying reuse code, have tutorial view controllers / views, call action sheet. however, calling views different. tutorial view(s) need added subview , added navigation controller. how can expand standard function cater these 2 different situations ? you can see i'm having instead, means duplicate code :( i have class called holds standard code, want add calls views here directly. -(void)showhelpclickbuttonatindex:(int)buttonindex:(uiview *)vw { if (buttonindex == commonuihelppagesbtnidx) { // nothing } else if (buttonindex == 0) { nslog(@"tutorial here"); } } i use in 1 view ... - (void)actionsheet:(uiactionsheet *)actionsheet clickedbuttonatindex:(nsinteger)buttonindex { commonui *cui = [commonui alloc]; [cui showhelpclickbuttonatindex:buttonindex:self.view]; [cui release]; if (buttonindex == commonuihelppagesbtnidx) { uiviewcontroller *thecontroller = [[helpviewcontroller alloc] initwithnibname:@"helpview"

c# - Get the paths of all referenced assemblies -

how paths of assemblies referenced executing assembly? getreferencedassmblies() gives me assemblyname[] s. how loaded from, there? you cannot know until assembly loaded. assembly resolution algorithm complicated , can't reliably guess front do. calling assembly.load(assemblyname) override reference assembly, , location property tells need. however, really don't want load assemblies front, before jit compiler it. inefficient , likelihood of problems not zero. example fire appdomain.assemblyresolve event before program ready respond it. avoid asking question.

Escaping & (special chars) in MySql or PHP -

the string- <object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/ebopiwpoxi0?fs=1&amp;hl=en_us"></param><param name="allowfullscreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/ebopiwpoxi0?fs=1&amp;hl=en_us" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object> what gets stored in database - <object width=\"480\" height=\"385\"><param name=\"movie\" value=\"http://www.youtube.com/v/ebopiwpoxi0?fs=1 already using - mysql_real_escape_string() , doesn't & : $_post['desc'] = mysql_real_escape_string($_post['desc']); mysql_quer

SQL Server SELECT LAST N Rows -

this known question best solution i've found like: select top n * mytable order id desc i've table lots of rows. not posibility use query because takes lot of time. how can select last n rows without using order by? edit sorry duplicated question of this one you can using row number partition feature also. great example can found here : i using orders table of northwind database... let retrieve last 5 orders placed employee 5: select orderid, customerid, orderdate ( select row_number() on (partition employeeid order orderdate desc) ordereddate,* orders ) ordlist ordlist.employeeid = 5 , ordlist.ordereddate <= 5

c# - context swtich between thread.start and thread.join -

is there bad effect if there context switch between thread.start , thread.join? if thread finish executing before join, happen? it depend bit on child thread doing you, if main thread creates child , more concurrent work while child thread away , child finishes execution first will, @ worst, have race condition. when have things happen in code depend on child thread doing work not implementing controls stop main thread proceeding if depends on work being finished. ultimately call .join result in instantanious return method wait until child thread/s have finished execution. however, watch out accidental race conditions, can right nightmare debug!

protocols - SIP client using scripting languages -

i looking implement sip voip client using of scripting languages - either perl, python or ruby or others. have knowledge of sip have not tried scripting languages. did have @ perl module net::sip same , found interesting. i looking provides sip functionality, not media support. there such sip implementations (like net::sip) in scripting world used purpose? required basic functionality testing , not stress testing. use sipp , relies on xml scripts send , receive sip messages, documented , used in telecommuncation industry.

java - widget remove itself -

i have widget below in ui.xml textbox, anchor_delete when anchor_delete press, @uihandler fired , want entire widget textbox , anchor_delete remove view. possible @uihandler("anchor_delete") void deleterowaction(clickevent event) { getwidget().removefromparent(); //i tried fail } did try: textbox.removefromparent(); anchor_delete.removefromparent(); assuming both widgets.

database design - MD5 hash as artificial keys -

i'm seeing lots of applications using hashes surrogate keys instead of plain integers. can't see reason kind of design. given uuid implementations hashed timestamps, why many database designers choose them application-wide surrogate keys? if data backend application made out of multiple distributed databases, using incremented integer ids might lead duplicated values. uuids guaranteed unique not inside application outside (which might helpful when joining external data). it true using different id seeds different databases in system solve uniqueness problem integers, managing such approach more difficult.

Javascript/jQuery function yields undefined in <IE8 -

a short while asked question here how calculate when heading longer 1 line within given container, , subsequently wrap each of these lines in <span> : use javascript/jquery determine heading breaks next line? i chose answer worked great me, @ least until checked in ie7 , ie6, in headings handled script rendered " undefinedundefinedundefinedundefinedundefinedundefined [...]" on page. i'm not javascript person (that's why asked such question in first place), it's tough me figure out problem is. assumed undefined variable or something, can't seem grasp it. can help? i'll repeat code here, please refer link above context: $(function(){ $h = $('.fixed').find('h3'); $h.each(function(i,e){ var txt = $(e).text(); $th = $('<h3 />').prependto($(e).parent()); var lh = $(e).text('x').height(); $(e).text(''); while (txt.length > 0) { $th.text($th.text() + txt[0]);

java - Is there a way to deep clone JSoup Document object and get back exactly same HTML? -

is there way deep clone jsoup document object , same html ? i have pre-parsed object want clone because suspect clone faster parsing html again. i've tried clone iterating through of elements of document object, i'm left without doctype declaration , such. p.s. don't of course expect comments... for node can call .clone() this implemented in feature request .

php - Symfony left join query -

i've got following query running correctly: $q = $this->createquery('e') ->where('e.persons_iduser =?', $request) ->leftjoin('e.jobtitles jt') ->leftjoin('e.employmentlevels el'); but when i'm iterate through result , try access fields left join: foreach ($work $w){ echo $w->employername; echo $w->jobtitle; // left join echo $w->employmentlevel; // left join } i got following error message: unknown record property / related component "jobtitle" on "experiences" anyone got clue? how echo field left join? <?php foreach ($work $w){ echo $w->employername; foreach($w->jobtitles $job){ echo $job->jobtitle; // left join } foreach($w->employmentlevels $employ){ echo $employ->employmentlevel; // left join } } ?> this work symfony returns array of objects , elements jo

android - When to call glMatrixMode() -

most opengl es tutorials android i've followed has onsurfacechanged() function this: public void onsurfacechanged( gl10 gl, int width, int height ) { gl.glviewport( 0, 0, width, height ); gl.glmatrixmode( gl10.gl_projection ); gl.glloadidentity(); glu.gluperspective( gl, 45.0f, ( ( float )width / ( float )height ), 0.1f, 100.0f ); gl.glmatrixmode( gl10.gl_modelview ); gl.glloadidentity(); } however, grouping here? must glmatrixmode() called after glviewport? , must glloadidentity() called right after glmatrixmode()? i've been coding "full" openggl before, , in old codes first called glmatrixmode(), gluperspective , last glloadidentity(). if 1 first set matrix should used gluperspective() , last set glidentity() finish it. what correct order calling glmatrixmode(), glidentity() , gluperspective() - , why? there differences between opengl , opengl es setting glmatrixmode()? glviewport() independent of matrix transform sta

Android disable screen timeout while app is running -

is there way disable screensaver while app running? the dimming of screen mean. you want use this: getwindow().addflags(windowmanager.layoutparams.flag_keep_screen_on);

php - Uploading video from website backend to YouTube -

i doing site in cakephp users can upload videos , published on site once approved moderator. currently, accepting video files being uploaded on server. these files downloaded , checked moderator , if seem fine moderator click button upload video youtube , save link in database. now, using clientlogin authenticate youtube , trying upload video using zend gdata libraries. there not documentation available on , not getting error back, not working: require_once 'zend/loader.php'; zend_loader::loadclass('zend_gdata_youtube'); zend_loader::loadclass('zend_gdata_clientlogin'); zend_loader::loadclass('zend_gdata_app_exception'); zend_loader::loadclass('zend_gdata_app_authexception'); zend_loader::loadclass('zend_gdata_app_httpexception'); zend_loader::loadclass('zend_gdata_youtube_videoentry'); // define variables $email = 'myemail@gmail.com'; $passwd = 'pass'; $applicationid = 'company-app-1.0'; $develope

Vim/MacVim: when I scroll with mouse, the text cursor moves too! -

i've been getting used vim/macvim last few weeks. 1 of main problems seem having when scroll around using mouse (especially when i'm trying select large portions of text) text insertion cursor moves , doesn't stay (like in textmate example). means i've selected large piece of text, when scroll review selection cursor move messes selection i've made. i realise should used text selection visual mode, , 1 bit of time, it's best tool use mouse. is there way of fixing behaviour? :help scrolling tells you: these commands move contents of window. if cursor position moved off of window, cursor moved onto window (with 'scrolloff' screen lines around it). so not possible leave cursor when scrolling. cursor visible in window, , therefore visual selection extend. probably xnoremap <scrollwheelup> <esc><scrollwheelup> , same scrollwheeldown. use gv restore selection.

indexing - Sequential UID set generation for MySQL Char() or other Field -

tried googling but: question : best way externally generate sequential uid values mysql field must representable string. reason: generic sequential uuid-ish values on-disk-order/page-appending inserts performance of writes , date prefixing read speed when searching index of field char[0] forward. column indexed, looking best data increase index read , table write performance rather plain-old-uuid. my initial thought date granularity (possibly padded epoch) appended or replacing portion of uuidv4 generated string ie [unix epoch][remaining uuid4] in fixed-width char field, unsure if have desired in-page/disk ordering result , index-searching result. example be: 12904645950049bceba1cc24e80806dd the values must independent of mysql itself, hence using uuids , timestamps rather variation of auto-incrementing. anyone knows internals of mysql indexes have suggestions (for innodb tables) ? aiden might bit offtopic, have @ twitter's snowflake . it's: (rou

c# - WPF How to get the control in a nested template -

so i've seen lots , lots of examples has nifty data template control in , content control applying template , code behind needs grab it. but have this: <datatemplate x:key="fronttemplate" > <stackpanel x:name="nowork"> <image source="images/1.png" stretch="fill" width="72" height="96" x:name="frontface" horizontalalignment="left" verticalalignment="top"></image> </stackpanel> </datatemplate> <datatemplate x:key="flipitemtemplate"> <grid width="200" height="200"> <border x:name="fronthost" background="transparent"> <contentpresenter content="{binding}" contenttemplate="{staticresource fronttemplate}" /> </border> </grid> </datatemplate> you can see have data template (fronttemplate) n

asp.net - What is the character expression for a new line in C#? -

i've got text box control on page , want people add urls, 1 on each line , split urls array. so, i'm trying split them on newline character. i've tried: .split(environment.newline) .split('vbcrlf') .split(vbcrlf) .split((char)environment.newline) but no avail. doing wrong? .split(new []{environment.newline}, stringsplitoptions.none); this because environment.newline string, must pass in array of strings, function overload requires, there needs stringsplitoptions value included. can either stringsplitoption.none or stringsplitoption.removeemptyentries .

ruby - Testing Sinatra Applications inside Rails -

i've created simple application assist me in learning rails. because challenge, i've started build, inside application, sinatra app (to handle api calls without overhead of full rails stack). i've come point want start testing both applications before move further, i'm not sure write tests sinatra app. it's presently located under lib/api - should create tests folder underneath that, or use main rails test folder @ root? you can test sinatra app in request of rspec example or integration test. in part need define url want request , see result.

iphone - ExitFullScreen button causes problems with MPMoviePlayerViewController and presentMoviePlayerViewControllerAnimated -

here situation : i call local movie url. function in custom viewcontroller in .h : mpmovieplayerviewcontroller* modalvideocontroller in .m -(void)startvideoad:(nsnotification*)notification { nsurl* url = (nsurl*)[notification object]; // no problem url ... check :) modalvideocontroller = [[mpmovieplayerviewcontroller alloc] initwithcontenturl:url]; [modalvideocontroller shouldautorotatetointerfaceorientation:yes]; [self presentmovieplayerviewcontrolleranimated:modalvideocontroller]; [modalvideocontroller release]; } problem : if user hit enter/exit fullscreen button (the double arrow button @ right of fastfoward button in video button panel), modalviewcontroller normaly disappear video still playing , no images sounds. is there way kill video after button pressed ? answer: -(void)viewdidappear:(bool)animated { [super viewdidappear:animated]; // avoid exitfullscreen button problem on fullscreen mode if(modalvideocontroller != nil)

multilingual - Making a website support multiple languages in PHP -

i searched , searched google , various forums problem , have seen various methods e.g. using databases, arrays, constants, files etc.. and internationalization , localization.. this diversity has confused me enough.. can please me guide best possible approach towards making multilingual website in php? or how can started localization concept in case best (which seems be). l10n or i18n requires special configuarations on webserver part? or can implemented on of apache webserver out there modifying of conf files hosting providers not allows change these settings. is there class can use? thanks! you can have at: internationalization of zend_form pretty easy use.

php - how to display an image from a mysql blob field in symfony? -

how display image mysql blob field in symfony? it's echo text 'array'. is possible add new property indexsuccess.php like <img src="<?php echo $persons->getphoto('[property]') ?>" /> or <img src="<?php echo $persons->getphoto()->[property] ?>" /> to print correctly? the src attribute contains location , not image data - exception of data uris. you need create page sets correct headers , outputs image data db, , point in src. the alternative echo data uri in src attribute. also keep in mind if have output escaping on, symfony escapes data in blob field while being passed view layer.

javascript - Save Data to Shapefile with OpenLayers -

i creating web application using openlayers. have implemented functionality such user can add point or polygon map displayed using javascript. need save data shapefile. ideas on how? i know it's old thread came here same question after doing bit of googling myself see if there out there. concluded there wasn't there be, wrote it: https://code.google.com/p/js2shapefile/ it's first time i've done along these lines in javascript i'm sure you'll find kinds of oddities code...but, works, esri javascript api graphics , google maps markers, @ rate. extended take openlayers vectors input too, haven't got round doing that.

soap - How do you create backwards compatible JAX-RS and JAX-WS APIs? -

jax-rs , jax-ws great producing api. however, don't address concern of backwards compatibility @ all. in order avoid breaking old client when new capabilities introduced api, have accept , provide exact same input , output format did before; many of xml , json parsers out there seem have fit if find field doesn't map anything, or has wrong type. some json libraries out there, such jackson , gson, provide feature can specify different input/output representation given object based on runtime setting, seems suitable way handle versioning many cases. makes possible provide backwards compatibility annotating added , removed fields appear according version of api in use client. neither jaxb nor other xml databinding library have found date has decent support concept, nevermind being able re-use same annotations both json , xml. adding jaxb-ri or eclipselink moxy seems potentially possible, daunting. the other approach versioning seems to version classes have changed,