Posts

Showing posts from June, 2011

.net - What 'quota' is being referred to in this exception message: Not enough quota is available to process this command -

i have .net application throws following exception: system.componentmodel.win32exception : not enough quota available process command @ ms.win32.unsafenativemethods.postmessage(handleref hwnd, int32 msg, intptr wparam, intptr lparam) @ ms.win32.managedwndproctracker.hookupdefwindowproc(intptr hwnd) @ ms.win32.managedwndproctracker.onappdomainprocessexit() @ ms.win32.managedwndproctracker.managedwndproctrackershutdownlistener.onshutdown(object target) @ ms.internal.shutdownlistener.handleshutdown(object sender, eventargs e) i can't reproduce exception personally, lots of exception reports users. what 'quota' being referred to? stack trace leads me believe might problem windows message queue. any ideas might cause error, or how fix appreciated. edit, further info: on 32 bit windows xp on machines, , exception not in my code such, .net framework event handler of sort. application not make postmessage calls. the amount of windows ...

jquery ui - message in empty <div> to drag -

i working on drag , drop tool using jquery ui's sortable widget. i'd add message empty div can dragged into, like: "drag here". i'd remove message in div. there times when page loads in div, can't on action, onload needs check too. how go it? here's code: $("#divfrom, #divto").sortable({ connectwith: '.connectedsortable' }).disableselection(); you should able set draggable , , droppable , tap droppable 's drop event handler, fired when item dropped: $("#target").droppable({ drop: function() { // empty droppable div: $(".message").remove(); } }); demo here: http://jsfiddle.net/andrewwhitaker/rugjf/2/ as doing similar on load, if provided markup make providing solution little easier (is there specific element inside droppable div check for?) hope helps.

Transforming file compliant with Xml Schema A into a file compliant with XML schema B using XSLT -

i have searched question, seems fiendishly hard express problem involving xsl in words, i've come nothing. the problem have thus: a company produces application uses xml files store 'documents'. these files enforced against schema version 1.1 however, company decides release new version of software validates against new schema different structure, schema 1.2 in order customer seamlessly use new version, want programmatically convert 1.1-compliant files 1.2-compliance on file open. ideally, using xsl transformation. of 2 schemas, types identical, types have new or renamed members, , stored in totally different structure. therefore writing transformation 1 other quite tedious, , maintaining more so. it nice write kind of transform-generating transform can match unchanged types old schema new one, , emit placeholder elements ( <xsl:message> elements, example) wherever can't so, in order prompt developer write custom logic hand it's needed, guaran...

python - How do I get Pyflakes to ignore a statement? -

a lot of our modules start with: try: import json except importerror: django.utils import simplejson json # python 2.4 fallback. ...and it's pyflakes warning in entire file: foo/bar.py:14: redefinition of unused 'json' line 12 how can pyflakes ignore this? (normally i'd go read the docs link broken. if nobody has answer, i'll read source.) if can use flake8 instead - wraps pyflakes pep8 checker - line ending with # noqa (in space significant - 2 spaces between end of code , # , 1 between , noqa text) tell checker ignore errors on line.

SQl Server Compact Edition Roadmap -

i working on business case using sql server ce upcoming project , have hard time convincing upper management go database solution. impression sql server ce not supported microsoft in future. during research, have not found evidence have not found official roadmap indicates otherwise. know references use in business case? have emailed ce team same question, have not heard them yet. thank in advance. i can't find support lifecycle recently released sql server ce 4 , previous version 3.5 supported until 2013: microsoft product lifecycle search products released | general availability date | mainstream support end date sql server compact 3.5 | 19/02/2008 | 09/04/2013 so chances new build supported 5 years - or longer if gets bundled next version of visual studio it'll pick vs support lifetime. general business , developer products support policy is microsoft offer minimum of 10 years of support business , developer products. mainstream support ...

sql - GROUP BY with date range -

i have table 4 columns, id , stream text, duration (int), , timestamp (datetime). there row inserted every time plays specific audio stream on website. stream name, , duration time in seconds listening. using following query figure total listen hours each week in year: select yearweek(`timestamp`), (sum(`duration`)/60/60) logs_main `stream`="asdf" group yearweek(`timestamp`); this expect... presenting total of listen time each week in year there data. however, build query have result row weeks there may not data. example, if 26th week of 2006 has no rows fall within week, sum result 0. is possible this? maybe via join on date range somehow? the tried true old school solution set table bunch of date ranges can outer join grouping (as in other table have of weeks in begin / end date). in case, table full of values yearweek: 201100 201101 201102 201103 201104 and here sketch of sql statement: select year_weeks.yearweek , (sum(`duration`)...

three20 - Need to cast in Objective C to use dot notation? -

this in context of using three20 relates more i'm not getting aout objective c. i'm in tttablelinkeditemcell , trying assign property called readat . //_item.readat = [[nsdate alloc] init]; "request member 'readat' in not structure or union" [_item setreadat: [[nsdate alloc] init]]; works expected. then... ((notificationitem *)_item).readat = [[nsdate alloc] init]; also works. seems need cast use dot notation, obj-c happily pass along messages blindly? correct rule i'm taking away this? ps: _item , per three20 api, is: tttablelinkeditem * _item . the compiler needs know object's type in order use dot notation access property — casting necessary if object wasn't statically typed begin with. message sends valid object, long variable has object type, work. so why need know static type property accessor? because property can designate method getter or setter, not default pair of foo , setfoo: , compiler needs know p...

blackberry - Modify class so that ButtonField is unselectable (never has focus) -

how can modify below class button field unselectable (never has focus), , therefore never highlighted ? thanks import net.rim.device.api.system.bitmap; import net.rim.device.api.ui.font; import net.rim.device.api.ui.graphics; import net.rim.device.api.ui.ui; import net.rim.device.api.ui.component.buttonfield; /** * button field bitmap label. */ public class bitmapfield extends buttonfield { private bitmap bitmap; private bitmap bitmaphighlight; private boolean highlighted = false; private int width; private string label; private font font; /** * instantiates new bitmap button field. * * @param bitmap bitmap use label */ public bitmapfield(bitmap bitmap, bitmap bitmaphighlight, string label, int width, font font) { this(bitmap, bitmaphighlight, buttonfield.consume_click|buttonfield.field_hcenter|buttonfield.field_vcenter , label, width, font); ...

Java Applet Panel Refresh -

i have java applet loads record of board game url , displays configuration using series of panels laid out in grid , nested in jpanel. small component of overall applet text fields , such inputs , outputs. when button pressed, want board show next configuration record. figured out way this, when button pressed, same configuration shown, when scroll or down, or resize window, configuration changes. there way "refresh" board jpanel when button pressed? currently, when button pressed, new configuration panel created, old configuration removed, , new configuration added display. thank much! if nothing else, try hiding , showing panel again. should force redraw.

java - Indexes of all occurrences of character in a string -

the following code print 2 string word = "bannanas"; string guess = "n"; int index; system.out.println( index = word.indexof(guess) ); i know how indexes of "n" ("guess") in string "bannanas" the expected result be: [2,3,5] this should print list of positions without -1 @ end peter lawrey's solution has had. int index = word.indexof(guess); while (index >= 0) { system.out.println(index); index = word.indexof(guess, index + 1); } it can done for loop: for (int index = word.indexof(guess); index >= 0; index = word.indexof(guess, index + 1)) { system.out.println(index); } [note: if guess can longer single character, possible, analyzing guess string, loop through word faster above loops do. benchmark such approach boyer-moore algorithm . however, conditions favor using such approach not seem present.]

mysql - When not to use SQL Cursors and joins -

using mysql, have table table 1 id d -------- 100 125 50 b 50 b 25 c 5 c 50 c 50 i need new table: sum id's = id's table new id d -------- 275 b 75 c 105 how using cursor id's? how using joins , temp table? insert table2 (id, d) select id, sum(d) table1 group id why use of other methods both inefficient , more complicated write?

plugins - Eventing in Ning -

i've been scouring api documentation have yet find this. i'm trying activity information ning network happens. want know whenever user comments, shares photo, etc. is there way (ideally without having poll changes)? can't find references eventing, callbacks, hooks, etc. the ning api doesn't have callback/event/hook api. polling activity endpoint or 1 of content specific endpoints option.

sortable - where does rails get the queries for nested objects? -

i've got nice 3-level nested-form using formtastic_cocoon (jquery), , want able sort 2nd set of items in form. i've got jquery ui working no problem, set , update sort order in rails. i started following rails bits of railscasts sortable lists http://asciicasts.com/episodes/147-sortable-lists the form structure user->tasks->location. in task model set index def index @task = task.find(params[:id],:order=>'position') end def edit @task = task.find(params[:id],:order=>'position') end and expecting console see ... 'tasks' ('users'.'id' = 12) order ('position') or along lines, there no order output. is there somewhere else need define order?? nested_object relationship from? model only? my models class user < activerecord::base has_many :tasks end class task < activerecord::base belongs_to :user end i changed model class user < activerecord::base ...

c# - LINQ group by not working -

i've read lots of group replies in forum, have ask anyway: var errandquery = (from t in db.timereportset group t new { t.errand.name, t.date } g select new errandtime { date = g.key.date, value = g.sum(e => e.hours) }).tolist(); why isn't working. following exception: "unknown column 'groupby1.k1' in 'field list'" the exception comes mysqlclient. you're not selecting hours g, aren't there sum. i don't know data looks try this: edit: var errandquery = (from t in db.timereportset group t new { t.errand.name, t.date } g select new errandtime { date = g.key.date, value = g.sum**(t => t.hours)** }).tolist(); sorry, first response incorrect. you linq query correct, except right @ end --- using e.. need reference items selected ... so need use t in lambda expression instead of e

iphone - IBAction used with Dynamically added UIbuttons -

good evening all! i have uibuttons added dynamically view , of course have ibaction handles button events. the problem is: how can detect button pressed if thing know (id)sender , array of buttons? buttons never same, every button has different behavior. when want use static buttons , connect them through ib use : -(ibaction)dosomething:(id)sender { if(sender == button1) dosomething; if(sender == button2) dosomething else; if(sender == button3) dosomething3; } in case not work because there no button1, button2, button3 mutablearray of buttons have same name allocated it. button! i tried using way above no success , tried getting tag of button have nothing compare to! i appreciate help. sincerely l_sonic ps dynamicaly means creating buttons in random time during run time this -(void)configactionsheetview { buttonview = [[uiview alloc]initwithframe:cgrectmake(0.0,460, 60, 480)]; [buttonview setbackgroundcolor:[uicolor bl...

android - PreferenceActivity lifecycle -

i read http://developer.android.com/reference/android/app/activity.html have question preferenceactivity lifecycle: does preferenceactivity onstop() or ondestory() call? i understand gets onstop() called when user clicks 'back', ondestory()? when ondesgtory() preferenceactivity called? thank you. as preferenceactivity subclass of activity , should follow same lifecycle. click on link provided , navigate indirect subclasses or here direct http://developer.android.com/reference/android/preference/preferenceactivity.html

Integrating 2 API's into 1 php class (OOP newbie) -

i want integrate google analytics , marchex (call tracking system) call analytics api's pull custom reports conversion rates , sort of thing. very, new world of object oriented programming, , think need guidance getting off ground. critique on constructor before move on further. doing right or what? <?php require_once("gapi.class.php"); require_once("xmlrpc.inc"); class garchex { private $marchex_credentials = array(), $ga_credentials = array(); private $marchex_account, $ga_account; public function __construct($marchex_credentials,$ga_credentials) { assert(is_array($marchex_credentials)); assert(is_array($ga_credentials)); //setup marchex stuff $this->marchex_credentials = $marchex_credentials; $this->marchex_account = new xmlrpc_client("/api/xmlrpc/1", "api.voicestar.com"); $this->marchex_account->setcredentials($marchex_credentials[0],$marchex_cre...

ruby on rails - Mongoid Associations -

i'm having problem i'm trying reference model called user twice comment model. the first instance because user can have many comments (as recipient) but other association comment has 1 author. references_one :user, :inverse_of :author would need association in user comments user opposed user. embedded_in :user, :inverse_of => :commentsout i hope makes bit of sense. maybe makes more sense (pseudo-code) user: has_many: comments => author can_be: author, recipient comment: belongs_to_many: users => recipients has_one: user => author if understand problem correctly can define associations this: class user include mongoid::document field :name, :type => string references_many :comments, :inverse_of => :author references_and_referenced_in_many :comments_received, :class_name => 'comment', :inverse_of => :recipients end class comment include mongoid::document field :text, :type =...

ruby on rails - Error running wkhtmltopdf -- (error while loading shared libraries) -

when app runs (or when run commandline) wkhtmltopdf command following error: (showing command line) #> wkhtmltopdf wkhtmltopdf: error while loading shared libraries: libxrender.so.1: cannot open shared object file: no such file or directory i noticed lib indeed in /usr/lib folder not /lib folder. matter 1 of these in? there way recognize it? #> ls -l /usr/lib/libxrender.so* lrwxrwxrwx 1 root root 19 feb 17 07:20 /usr/lib/libxrender.so -> libxrender.so.1.3.0 lrwxrwxrwx 1 root root 19 feb 17 07:20 /usr/lib/libxrender.so.1 -> libxrender.so.1.3.0 -rwxr-xr-x 1 root root 39184 jan 29 2010 /usr/lib/libxrender.so.1.3.0 #> ls -l /lib/libxrender.so* ls: cannot access /lib/libxrender.so*: no such file or directory i checked dependencies of lib # ldd /usr/lib/libxrender.so.1 libx11.so.6 => /usr/lib/libx11.so.6 (0x00002b9cb5afd000) libc.so.6 => /lib/libc.so.6 (0x00002b9cb5e04000) libxau.so.6 => /usr/lib/libxau.so.6 (0x00002b9cb6143000) ...

c++ - Faulting application splwow64.exe -

i running windows 7 64 pro. when start vmware player, windows xp service pack 3 installed, error message "this application has requested runtime terminate in unusual way" microsoft visual c++. have dug event log , telling me splwow64.exe faulting application. concerned @ first know 32 bit print spooler not seem such big deal annoying. thoughts on how correct problem? splwow64 has issues vmware (leaks memory). remove printers guest machine on vmware, should work normally.

ruby - Watir can't locate frame which houses an element in Firefox but works fine in IE -

i have script: browser.frame( :name, 'frame_navigation' ).span(:text=>'foo').fire_event('onmouseup') which clicks on elements of tree view (inside frame) works great in ie, when set: require 'watir' watir::browser.default = 'firefox' and run get: failure/error: browser.frame( :name, 'frame_navigation').span(:text=>'foo').fire_event('onmouseup') watir::exception::unknownframeexception: unable locate frame using name , frame_navigation. i elements inside frame on page. not tree view. i've tried requiring firewatir well, or on own no luck. any insight appreciated! thanks, -m you're not using frame method correctly. try way: browser.frame(:name => 'frame_navigation').span(:text => 'foo').fire_event('onmouseup')

wcf - How to implement repository pattern for multiple database -

we have 2 presentation projects (classic asp , asp.net, uses "nhibernate best practices asp.net" (predecessor or sharp architecture). rewrite classic asp silverlight + wcf(maybe ria services). we have following database architecture: * 1 global data database - contains users , projects meta info * each project has own database store project-specific info - same schema we able hack bit make multiple databases work in asp.net because "nhibernate best practices asp.net" uses dao factories, can hack bit create connection string - base on projectid - pass factory create corresponding nhibernate session. for rewrite, use repository pattern sharp architecture. couldn't figure out how similar hack... any appreciated. have @ ncommon framework provides nice foundation multi-database support in nhibernate explained in blog post .

How do I bind a WPF control's content to its container's DataContext so I can apply a DataTemplateSelector based on that object? -

i'm trying bind wpf window atop viewmodel contains 2 collections, , b. i'm attempting use datatemplates display either or b depending on setting of flag in viewmodel. to end, i've set window's datacontext = viewmodel . however, when attempt bind contentcontrol datacontext , apply datatemplateselector it, item parameter of selector's selecttemplate(object item, dependencyobject container) method null: <window [snip] title="mainwindow"> <window.resources> <!-- datatemplate , selector declarations --> </window.resources> <grid> <contentcontrol content="{binding}" contenttemplateselector="{staticresource templateselector}" /> </grid> </window> how should binding contentcontrol such window's viewmodel passed through datatemplateselector ? this worked me: <contentcontrol content="{bind...

class - distinct classes using `with` in Python -

if have following class: class foo(object): def __init__(name): self.name = name and use in file called check_foo.py with foo("naming it"): print foo.name foo("naming another"): print foo.name if import check_foo , run dir(check_foo) single check_foo.foo module. i know pep 343 mentions can like: with foo("naming it") naming_it: print naming_it.name and instantiated in check_foo check_foo.naming_it question is possible work around , set name dynamically. i'm playing around proof of concept , want know how far can above idea. could possible name instance using string passing foo ? note: aware withhacks . let's not suggest take @ :) i'm not sure if sort of hackery looking for... import inspect class renameable(object): def rename_me(self, new_name): stack_frame in inspect.stack()[1:]: frame_object = stack_frame[0] # frame first object in tuple (name, value) in f...

how to get some text informations from a nontext file using batch commands in Windows? -

guys. i'm trying file version inside nontext files. in each of them (approximately @ beginning) there few text lines containing informations file. example: [some nontext data (very few)] version: 455467 build date: 23.11.2010 ..... [rest of nontext data] if want i'll try make such file can't show original files (my company won't allow it). sorry... i tried code: @echo off /f "tokens=1,2" %%a in (file.dat) if %%a==version: (set version=%%b goto found) echo not found goto end :found echo found: %version% :end pause but works if "file.dat" text file, if not "not found". if replace file.dat 'type file.dat' not return (processor usage 100%). if replace file.dat 'find /i "version:" file.dat' works, it's very, slow (minutes). since have process many files , have little time can't use it. works lot faster if enter each file manually viewer , copy version number; point want cmd... oh, , can't ins...

MediaPlayer Android Increment on button click -

i have created button , need increment mp3 tunes on click. so far have mp3 playing like: final mediaplayer sentence = mediaplayer.create(options.this, r.raw.indra); and calling sentence.start(); in onclick. is possible increment more tunes in onclick? thanks.

JavaScript cookie setting used to work and stopped -

in nutshell, have web application used able set cookies fine, no longer works. strange thing i've used chrome's debugger follow what's going on, , makes way "document.cookie = " statement fine. further, haven't changed except content of cookie (adding more information). haven't modified cookie setting logic @ all, or parameters. here's recent version of application: http://asmor.com/scripts/tsrand/alpha/ the relevant bit lines 147-149, http://asmor.com/scripts/tsrand/alpha/init.js cookie=json.stringify(opt) log("cookie: "+cookie); $.cookie(cookiename, cookie, { expires: 365 }); opt object i'm using store form element values. convert object json string , store it. here's example of cookie contains in version of program: {"diseaseselect":".5","sologame":"checkbox:false","showlog":"checkbox:true","min_setting":"0","max_setting":...

java - JPA 2 query giving strange behavior on OR clause -

i have jpa 2 query driving me nuts. surveyquestion may have organization. here's mapping within surveyquestion @manytoone( optional=true ) @joincolumn( name="organization_key" ) private organization organization; organization has field named key. create typednamedquery following jpql select q surveyquestion q q.organization null or q.organization.key = :organizationkey with query questions have given key. if remove q.organization.key = :organizationkey query, have no organization, can't life of me return combination of have no organization or have given organization. jpa2 eclipselink provider. this jpa standard. q.organization.key resolves inner join on q.organization, not left join! you have this: select q surveyquestion q left join q.organization o o null or o.key = :organizationkey

iphone - Problem with getting a modalViewController to appear -

i've been fighting hours. i've searched around everywhere , can't seem find solution problem. i'm pretty sure i'm lacking key concepts here. my appdelegate (didfinishlaunching) sets window , invokes rootviewcontroller: // create our window uiwindow *window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; [window setbackgroundcolor:[uicolor blackcolor]]; // create our rootviewcontroller rootviewcontroller *controller = [[rootviewcontroller alloc] init]; // add our rootviewcontroller's view our window [window addsubview:controller.view]; // controller owned window's view [controller release]; // show world [window makekeyandvisible]; when add controller.view window's subview, understanding rootvc's loadview automatically called. in rootvc loadview, create tabbarcontroller, each tab having navigationcontroller , it's own viewcontroller. working fine. in rootvc viewdidload, i'm checking see if fir...

google app engine - gae bulkloader won't parse key name on import? -

in default bulkloader.yaml said this: # - check __key__ property want. value become # key name on import, , on export value key # object. if automatic key generation on import , # omitting key on export, can remove entire __key__ # property property map. so assume default implementation: - property: __key__ external_name: key export_transform: transform.key_id_or_name_as_string should import key column in csv file datastore no problem. appear nothing. (other columns parsed fine though) you need import_transform key datastore. export transform writing out csv file. i don't think there's built-in transform method turn string key. i wrote 2 helper functions dealing exporting , importing keys: key_to_reverse_str (export) , reverse_str_to_key (import) idea keep value human readable on exporting, keep data needed import. might useful you.

whats wrong with my c++ list<string> -

bee.cpp list<string> urls; urls.push_back ("one"); urls.push_back ("two"); urls.push_back ("three"); urls.sort(); tp(urls); tp.h namespace std { class tp { public: tp(list<string> u); virtual ~threadpool(); }; } tp.c++ tp::tp(list<string> u) { list<string>::iterator it; (it=mylist.begin(); it!=mylist.end(); ++it) cout << " " << *it; } tp::~tp() { // todo auto-generated destructor stub } it works in same function under 1 file if use class shows me error ../src/bee.cpp: in function ‘int main()’: ../src/bee.cpp:31: error: conflicting declaration ‘std::tp u’ ../src/bee.cpp:24: error: ‘u’ has previous declaration ‘std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char...

Rails 3: Json problem on the client side -

i've code below <script type="text/javascript"> var reports = <%= @reports.to_json %>; </script> and in output i've result " replaced &quot; "[{\"status\":\"available\", ... ... ... how rails provide raw json data javascript can understand it? way <%= raw @reports.to_json %> doesn't seems work. sultan try var reports = <%= @reports.to_json.html_safe %>; you may want read on safebuffers on katz's blog (rails core team member) or railscasts .

javascript - Using window.print() to print a different stylesheet without restyling the page? -

i have print button on page run window.print(), prints page exactly. there way pass parameter function print page stylesheet print.css rather style.css, without necessitating page refresh? in css put print specific css rules @media print{ } and css rules displaying into @media screen, projection, tv{ } html this <link href="default.css" rel="stylesheet" type="text/css" media="all" /> <link href="print.css" rel="stylesheet" type="text/css" media="print" />

multi level menu with css &html? -

i wish create multi level menu pure css & html. position of menu should controlled css.can me? there's great css menu @ http://www.cssplay.co.uk/menus/final_drop.html support down ie5.5

Resources on declarative/logic programming? -

hi have resources on declaritive programming languages, more , newer better. i find krzysztof apt's book on constraint programming clear, if maybe little on theoretical side if you're looking "programming languages". the author's page links reviews. there few related questions can recommend: https://stackoverflow.com/questions/1082121/what-are-the-best-introductory-logic-programming-books https://stackoverflow.com/questions/401635/good-beginners-material-on-prolog

java - How do I send a ByteArray from Android to PHP? -

i'm trying send jpg out of app php listener , seems bytearray right way handle this. however, when request have gets server, has filename parameter (which separate) not bytearray param. in case of bytearray it's missing both key , value of field. in debugger, can see data in request... perhaps i'm not collecting correctly on php side? here relevant parts of code... appreciated (as advice in alternate, more effective, way). android: try { part[] parts = new part[2]; bytearraypartsource ps = new bytearraypartsource( printfilename, bitmapdata); parts[0] = new filepart("filedata", ps); parts[1] = new stringpart("filename" ,printfilename); filepost.setrequestentity(new multipartrequestentity(parts, filepost.getparams())); } catch (exception e) { log.d("my_debug", e.tostring()); } try { int statuscode1 = client.executemethod(filepost); ...

How to insert arraylist or vector into SQLite Database in android? -

i new android. need store arraylist or vector in database(sqlite) value 1 of column. have searched regarding storing arraylist or vector. in thant suggested convert arraylist json. there other solution problem other converting arraylist json. please give me solution or article regarding issue. its urgent. please me. vectors , lists data structures. sqlite columns accept atomic values, namely numbers, strings , blobs. therefore need serialize (convert) vector/list single string or blob - numbers won't anyway. have use encoding uniquely reversible , preserve special properties of data structure. sure, can re-invent wheel , use own encoding. or semi-reinvent wheel using java serialization api. or use json, more tried solution. if you, however, i'd first consider changing database schema. lists , vectors close enough relational model might able store them in database without serialization techniques. edit: see this question , this one .

windows - File Type .pl Association and Using cmd.exe to Run the Script -

i've made new file type .pl (explorer->tools->folder options...->file types). wanted make new action call cmd.exe , automatically run perl script.i don't know write under "applications used perform action" ,i have pass cmd.exe arguments don't know which. form of arguments should ,i suppose, be:[cmd.exe] < file location > perl < file name > to permanently associate *.pl perl.exe , @ command prompt type following. assoc .pl=perlscript ftype perlscript=c:\perl\bin\perl.exe %1 %* note associate *.pl wperl.exe , run script without visible command window. wperl.exe part of activestate perl distribution .

regex - Postcode url rewrite using IIS7 URL Rewrite not working -

i have started using iis7 , setting various url rewrites. new may making novice mistake. i trying rewrite postcode can have /ka71dr rewrite /gis/property.asp?postcode=ka71dr i have following it's not working: <rule name="postcode"> <match url="^/[a-za-z]{1,2}[0-9][0-9a-za-z]{0,1} {0,1}[0-9][a-za-z]{2}$" /> <action type="rewrite" url="/gis/property.aspx?postcode={r:0}" /> </rule> the test pattern works. when try page returns 404. can suggest doing wrong? had remove leading slash , worked.

c# - SOAP Service AND JSF/Icefaces in a single Application -

i've got jsf/icefaces webapplication (mainly website can buy stuff) , have desktopapplication written in c# (where can use bought stuff) but desktapp needs acces server via soap services (to retrieve bought elements) what best practice - soap , jsf in 1 app, or 2 seperate applications? thanks help i'm not sure how benefit new application (i.e. new domain or context)? i have similar situation use jsf web front , servlet web service requests , works absolutely fine. if using ejb3.0 can create web services @webservice annotation on state beans.

controller - Play song in android in default media player.... i dont want to create my own -

hi guys want make simple application. have 1 button when clicked play song who's uri hard coded. want user click button , song play in default media player don't have code media player buttons. is possible ? u have better approach? this whole situation arises problem of fetching album art :) maybe helps ya: mediaplayer mp = new mediaplayer(); mp.setlooping(true); try { mp.setdatasource(mfile); } catch (illegalargumentexception e) { e.printstacktrace(); } catch (illegalstateexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } try { mp.prepare(); } catch (illegalstateexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } mp.start(); mfile path mp3-file. maybe can share uri instead.

asp.net - Load a javascript function while page loads -

hi want run javascript function when page loads. page derives master page there no form . aspx file <%@ page title="" language="vb" masterpagefile="~/site.master" autoeventwireup="false" codefile="test3.aspx.vb" inherits="test3" %> <asp:content id="content1" contentplaceholderid="headcontent" runat="server"> <script language="javascript"> var m_names = new array(); function loadarray() { pagemethods.load_array(onsucceeded, onfailed); } function onsucceeded(result, usercontext, methodname) { m_names = result; } function onfailed(error, usercontext, methodname) { alert("an error occurred") } </script> </asp:content> <asp:content id="content2" contentplaceholderid="maincontent" runat="server"> <asp:scriptmanager id="scriptmanager1" runat=...

POST request using sockets C# -

i'm trying make auction sniper site. place bid need send 4 parameters(and cookies of course) /auction/place_bid. need use sockets, not httpwebrequest. here's code: string request1 = "post /auction/place_bid http/1.1\r\nhost: *host here*\r\nconnection: keep-alive\r\nuser-agent: mozilla/4.0 (compatible; msie 6.0; windows nt 5.2; .net clr 1.0.3705;)\r\naccept: /*\r\ncontent-type: application/x-www-form-urlencoded; charset=utf-8\r\nx-requested-with: xmlhttprequest\r\n" + cookies +"\r\n"; string request3 = "token=" + token + "&aid=" + aid + "&bidreq=" + ptzreq + "&recaptcha_challenge_field=" + rcf + "&recaptcha_response_field=" + rrf+"\r\n\r\n"; string request2 = "content-length: " + (encoding.utf8.getbytecount(request1+request3)+23).tostring() + "\r\n"; byte[] datasent = encoding.utf8.getbytes(request1+request2+request3); ...

c# - Should I be reusing collections passed as parameters -

yesterday spent time trying find bug. long story short, realized because of constructor: public triangle(list<vertex> vertices) { this._values = vertices; } i tried initialize object list of values , object took reference object instead of getting values list. if don't abandon list passed parameter , use later else initializing else same values or if decide clear , fill new values, destroy state of triangle object without knowing it. my first reaction "fix bug" in constructor started thinking if it's way should be. what's practice covers things that? in general, should think constructors/init methods take list of values? should leave intact? allowed reuse list , fault when leads error? i mean, can that: var triangle = new triangle(new list<vertex>(vertices)); but shouldn't done creators of triangle class already? i know guidelines on that. thanks. personally agree henk; should create copy. /// <summary> ...

javascript - Preventing a callback from executing until input stops -

a timer fire ajax call if no key pressed. if key pressed, abort last timer , add new timer. want failed success. here code: var t; input.onkeyup = function(){ $('.confirmtext').html('checking...'); var timestampobj = new date() var timestamp = timestampobj.gettime(); var oldtimestamp = $(this).attr('timestamp');//i store timestamp in element if(timestamp < 500 + oldtimestamp){ $(this).attr('timestamp', timestamp); cleartimeout(t); } t = settimeout(function(){ $.ajax({ url: 'serverscripts/settings/checkemailavailability.php', data: 'email='+email, success: function(text){ if(text == 'available'){ $('.confirmtext').html('available!'); }else{ $('.confirmtext').html('occupied!'); } } }); }, 500);//half second ...

ruby on rails - How do I debug an error in a gem? -

i'm getting error paperclip gem. nomethoderror (you have nil object when didn't expect it! might have expected instance of array. error occurred while evaluating nil.size): paperclip (2.3.8) lib/paperclip/attachment.rb:104:in `assign' how can debug this, seeing though it's in gem? if code place few puts see what's going on, can't here. i'm using rails 3.0.1 here's best shot. open 1 of controllers , add debugger line it. need debugger kick in set breakpoint next run rails --debug navigate page / controller breakpoint the debugger console appear. run gem.find_files("attachment.rb") <- i'll call $gem_root path returns run list $gem_root/lib/paperclip/attachment.rb:104 - show code around area error occurred. run b $gem_root/lib/paperclip/attachment.rb:$line - replace $line candidate breakpoint. run cont hit page / action causes error, , debug console should open @ break point. i think there must way pat...

addeventlistener - google maps mousemove and click listener together -

i use mousemove listener on google maps, while want handle click event too. var path = new google.maps.mvcarray; ... line = new google.maps.polyline({ map: map, path: new google.maps.mvcarray([path]), }); google.maps.event.addlistener(map, 'click', function(event) { path.push(event.latlng); }); google.maps.event.addlistener(map, 'mousemove', function(event) { if (path.getlength() > 1) path.setat(path.getlength()-1,event.latlng); }); i want follow mouse line, if user click on map, push polyline's array. click event doesn't work... idea? i think there small bug in code: on line 5 should read path: path, instead of path: new google.maps.mvcarray([path]), reason: var path mcvarray , property path of polylineoptions expects mvcarray, supply mvcarray inside normal array inside mvcarray. this prevents code following pushing coordinates correct array.

css position - CSS: display:inline-block and positioning:absolute -

please consider following code: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <style type="text/css"> .section { display: block; width: 200px; border: 1px dashed blue; margin-bottom: 10px; } .element-left, .element-right-a, .element-right-b { display: inline-block; background-color: #ccc; vertical-align: top; } .element-right-a, .element-right-b { max-width: 100px; } .element-right-b { position: absolute; left: 100px; } </style> <title>test</title> </head> <body> <div class="section"> <span class="element-left"...

c# 4.0 - How to Implicitly Convert an Enumerable of a type with Implicit Conversion Operators in C# 4.0 -

given: public struct id { readonly int m_id; public id(int id) { m_id = id; } public static implicit operator int(id id) { return id.m_id; } public static implicit operator id(int id) { return new id(id); } } can implicitly convert ienumerable<int> to ienumerable<id> and vice versa. in way. note var ids = new int[]{ 1, 2 }; ids.cast<id>(); does not appear work , covariance not appear working in case, either. of course, doing select work i.e.: ids.select(id => new id(id)); but looking make work implicitly, writing: ienumerable<id> ids = new int[]{ 1, 2 }; and yes, know can written as: ienumerable<id> ids = new id[]{ 1, 2 }; but issue in cases enumerable of ints comes different source, such file example. i sorry if there answer this, not find it. according this answer want not possible. can close not implicitly casting id collection. : public class ids : list<int> { pub...

T4 From Partially Trusted ASP.NET shared webhost -

is there way host t4 in partially trusted asp.net environment if templates don't change should use precompiled (runtime) templates don't need host - instantiate template clases , call transformtext() method. regular (design-time) t4 not supported on server.

asp.net - Performance difference of code in aspx and cs files for showing and hiding a control dynamically -

i thinking performance when use code hide control in aspx page using delimiters or in cs file. for e.g. if have panel , want shown following condition, can achieve 2 ways 1: using code in aspx file, this <% if(isallowed) { %> <asp:panel ...></asp:panel> <% } %> 2: in code file, this <asp:panel id="pnlmypanel" visible="false"></asp:panel> and in cs file if(isallowed) pnlmypanel.visible=true; in view, first way should not @ create panel in page. correct here? please guide me method preferable honestly have no idea quicker, doubt difference have appreciable effect on performance of application.

.net - c# columns names from ilist -

this may simple. have created class list public class lstlog { public string column1; public string column2; public string column3; public string column4; // methods public lstlog(string column1, string column2, string column3, string column4) { this.column1 = column1; this.column2 = column2; this.column3 = column3; this.column4 = column4; } i can insert , read contents of list @ runtime. column names @ runtime. possible? thanks. you should use dictionary can query columns name , add/insert new ones needed. public class lstlog { private dictionary<string, string> columndictionary = new dictionary<string, string>(); // methods public lstlog(string column1, string column2, string column3, string column4) { columndictionary["column1"] = column1; columndictionary["column2"] = column1; columndictionary["column3"] = column1; ...

c# - Why won't my ascx file pick up my code behind properties? -

my web app solution built on top of solution. base solution meant platform multiple products. part, works fine, weird things happen when create product specific views. i using viewusercontrol<someviewmodel> code behind class. in code behind, have access this.model , other goodies i'd expect class. in ascx file, red squiggley lines when try access this.model or other properties defined in viewusercontrol . red squiggley lines when try access properties defined directly in code behind. what's more interesting is, don't real errors this. view renders fine @ run time , not give me build errors. ascx file thinks there errors. if create the exact same view in platform namespaces, works fine. no red squiggles. i find annoying. it's not show stopper means, if i'm going using ide intellisense , jazz, i'd sure work properly, , pick properties supposed there. has else run this? know of way fix this? thanks! edit it requested post code. here...

jquery - Use a function to set a variable with Javascript? -

i trying use javascript , jquery build html table based on information returned database. have json , database hit working properly, unable show data on page. this code display data var temp; var init = function() { $(_getmarketinfo()).appendto(document.body); // used logging temp = $(_getmarketinfo()); console.log(temp); }; and , process data function _getmarketinfo() { $.ajax({ url:'scripts/db_getmarketinfo.cgi', datatype:'json', success:function(data, teststatus) { var html = ''; html +='<div class="marketinfoholder">'; html +='<table class="tbl" border=1>'; html +=' <tr><th>market information</th></tr>'; html +=' <tr><td>market</td></tr>'; (var i=0;i< data.marketinfo.length; i++){ html += '...

What's the proper way to set the Location header for an HTTP 201 response in a Java Servlet application -

consider following code sending http 201 "created" response client: string url = "/app/things?id=42"; // example response.setstatus(httpservletresponse.sc_created); response.setcontenttype("text/plain"); response.setheader("location", url); response.getwriter().print(url); it informs client new "thing" created , can found @ url /app/things?id=42 . problem url relative. perfect jsp, might written follows: <img src="<c:url value="/things?id=42" />" /> which produce following html: <img src="/app/things?id=42" /> which want web apps. but don't believe want 201 response location header. http spec states : 14.30 location the location response-header field used redirect recipient location other request-uri completion of request or identification of new resource. 201 (created) responses, location of new resource created request. 3xx responses, ...

Export a whole MS Access database to CSV -

i have 37 table ms access database. have, in past, exported tables csv 1 @ time. there way export tables csv in single stroke? you can use tabledefs collection , transfertext .

sql server - Defining View in Entity Data Model -

i trying add view entity data model error below. view group count. don’t understand because view not have primary key it’s nature. i modified original post because figured out how add key view. still have same problem. warning 6013: table/view 'fmcsa.dbo.viefmcsadocumentcount' not have primary key defined , no valid primary key inferred. table/view has been excluded. use entity, need review schema, add correct keys, , uncomment it. here view create view [dbo].[viefmcsadocumentcount] schemabinding as select count_big(*) countofdocs, role_id, owner_id dbo.fmcsa_document group role_id, owner_id then can add key create unique clustered index [mainindex] on [dbo].[viefmcsadocumentcount] ( [owner_id] asc, [role_id] asc ) still not working. you didn't specify, i'm assuming you're using ef4. i've come across before--you either want define key manually or edit recreate view with schemabinding , reimp...