Posts

Showing posts from January, 2012

python - Serializing form data - picke or XML? -

i trying save form data, , wondering if should use python's native pickle , or sort of xml serializer. wanted use django's serializers these seem geared @ working wit models, not regular python dictionaries/objects. the object want serialize composed entirely of strings (and possibly integers) , this: data = { 'var1': "foo", 'var2': "bar", 'var3': ['bar', 'foo', 'moo', 'fish'], 'var4': 42 } and want save because need able render html page based on these values @ point in future. should go ahead saving pickled object - or should save xml? don't see advantages of using xml, since not planning access outside of django. making wrong decision? few notes: this not want save in session or cache, because want keep history of these forms indefinitely the format/layout of forms subject change making db schema hold information impractical. what json ? it's lightweight, readable, port...

asp.net 4.0 - How to use IntelliTrace Standalone Collector to detect memory leaks in production .Net applications? -

visual studio 2012rc has ability use externally collected trace files of iis app pool data collected intellittrace standalone collector. know in production app there kind of memory leak apparent after few hours of monitoring. i have large itrace file ready plug vs2012, know how find questionable object. i in process of using debugger tools , following these instructions. however, run error indicating appropriate clr files (or that) not loaded when trying .load sos or other command. i hoping see similar address list , consumed memory in intellitrace analyzer - possible? some assistance appreciated. intellitrace profiles events , method calls. won't information on individual objects or memory leaks because it's not tracking memory. there's no event provided object creation/destruction can't infer in case. to track memory have use profiling tools on app, though don't attach them production server! use test environment , see if can replicate problem.

How do I remove Windows SBS and just retain Windows Server and its functionality? -

ok acquired new position business runs windows sbs server. have onsite manage network want disolve sbs can. know lot of thinking, leave alone! however, have 2 fold problem. 1.) expanding hardware resources not option. 2.) company needs go towards more enterprise solution. so herein lies question, how remove sbs server without losing entire server? well ok able solve 1 of dilemmas. sbs monitoring hogging of resources on server. turned off , been working better. looking @ guess question how save resources on sbs server.

Assistance with understanding php urls -

i'm looking @ websites use php , see a[]=val1 instead of b=val2 . question why there brackets in url? type of code produce effect? why brackets in url? the brackets in url indicate val1 assigned next position in array a . if confused blank part of bracket, @ how php arrays work . what kind of code produce this? as code create such url, either explicit definition coder or other script, or somehow created form using method="get" attribute. example: to create this, can define array name of input field so: <form method="get"> <input name="a[]" ... /> <input name="a[]" ... /> <input name="a[]" ... /> </form> or can make link (the a tag) url: <a href="foo.php?a[]=val1&a[]=val2&a[]=val3">click me!</a> parse url php, use $_get variable retrieve values url: <?php $a = $_get['a']; $val1 = $a[0]; $val2 = $a[1]; $val3 = $a[2]; ... print_r($a); ?> t...

javascript - ThunderBird Event for Viewing a Message -

i'm trying modify message before displayed in main window in thunderbird. can't seem find 1) event triggered when new message opened/viewed 2) way modify displayed contents of message. i believe need chrome://messenger/content/messenger.xul overlay, , can use listener such as: window.addeventlistener( "some magic here", modify_message_handler, true ); but event is, unsure, along object (a message header?) , how can modify displayed. so questions are: do have correct overlay? can done events? if not, how? if so, event needed , object pass? if want similar greasemonkey script run on every message, should: wait load event of window . retrieve message pane object document.getelementbyid("messagepane") . bind handler message pane's domcontentloaded event, or similar events load depending on when want handler called. domcontentloaded give greasemonkey-style behavior. in event handler, event.originaltarget document corresponding display...

python - Get AttributeError after upgrading to IPython13 -

i upgraded ipython installation pip , , when use ipython , failed this: traceback (most recent call last): file "<string>", line 1, in <module> attributeerror: 'module' object has no attribute 'shell' but when try $(which ipython) , starts normally. what may reason of attributeerror ? look under ~/.ipython. there's configuration script there using old api.

c# - Best practice for consistently cancelling Async CancellationTokenSource -

so have combobox on ui on selectionchanged asynchronously goes off web service pull information displayed on ui (using new c#5 async/await keywords). i'm looking cancel current async request before sending new one; example if user uses keyboard cycle through of combobox items, selectionchanged event fire multiple times (generating multiple async requests) before first async request returns. so async function gets called combobox's selectionchanged event looks this: public async task<connections> connectionsasync() { return await task.factory.startnew(() => connections, _cancellationtokensource.token); } where connections property goes off , hits web service. because cancellationtokensource cannot reused once cancelled, i'm thinking of doing this: public async task<connections> connectionsasync() { _cancellationtokensource.cancel(); _cancellationtokensource = new cancellationtokensource(); return await task.factory.startnew(() => connections, _cancella...

php - MySQL Syntax Error at long entered text -

i trying build php form mysql. problem error every time if try add long text field. the error you have error in sql syntax; check manual corresponds mysql server version right syntax use near.....at line 1 the php code generating query this: <?php if ( $_get['aktion'] == "speichern" ) { $title = $_get['title']; $description = $_get['description']; $applepart = $_get['applepart']; $partnumber = $_get['partnumber']; $productcode = $_get['productcode']; $compatibility = $_get['compatibility']; $url_bild = $_get['url_bild']; $price = $_get['price']; $sql = "insert adressbuch "; $sql .= " set "; $sql .= " title = '$title', "; $sql .= " description = '$description', "; $sql .= " applepart = '$applepart', "; $sql .= " partnumber = '$partnumber', "; $sql .= " productcode = '$productcode', "; $sq...

user interface - Basic GUI functionality in C++ -

is there basic way draw in c++? i know there lot of engines, libraries etc. these libraries have use basic drawing function or whatever is. mean without non-standart c++ libraries able make console applications. new libraries can draw something, or atleast show different standard command line, have use basic function allows make different without commandline. i've heard win32 api (i'm not targeting windows platform,vbut i'm using windows, still have ubuntu(wubi)). can't belive way use win32 api. so guess questions follows: are gui(or non-console) libraries using win32 api basic? are linux developers required use linux api gui? (sorry english, it's not native language) the operating system (on modern computer) in charge of screen have use it's functions draw on screen. there whole range of libraries high level ones, displaying video single line of code, low level ones can determine details of every pixel. as drawing on screen gui library, or toolki...

java - Trying to use abstract data types - How to call the methods through inheritence -

i trying test abstract class running problems when call methods test class. has been while since used java , have not used abstract classes before. pointers on going wrong appreciated. thanks. the abstract class public abstract class rationalnumbers { public int numerator, denominator, temp; public void setnumerator(int n) { numerator = n; } public void setdenominator(int d) { denominator = d; } public int getnumerator() { return numerator; } public int getdenominator() { return denominator; } public int add() { temp = numerator + denominator; return temp; } public int subtract() { temp = numerator - denominator; return temp; } public int multiply() { temp = numerator * denominator; return temp; } public int divide() { temp = numerator / denominator; return temp; } public boolean isequal() { boolean isequal; if (numerator == denominator) { isequal = true; } else { isequal = false; } return isequal; } } the test class public class testclass extends rationalnumbers { public static v...

design patterns - Entity Framework, MVVM, and Calculations Classes -

i'm working on database application manages industry-specific inputs , runs information through complicated calculations, lookups, etc. return series of other values , go/no-go conclusion. i've decided use entity framework (code first provider independence) , wpf (mvvm pattern). i'm using poco entities data model , view model handling usuals basic data / business rule validation. it seems ef + wpf/mvvm great @ displaying , validating input , getting database querying typical business application products, customers, orders setup. it's not @ clear plug in "calculations layer". between view models , data models (my pocos), things feeling bit bloated, , i'm facing adding layer other two. perhaps best way approach make calculations layer sort of meta-view model , push of validations, change notification, etc. them , run lighter actual view models. anyone run situation this? edit turns out needed thin view models , beef entities. lightened view models, m...

jquery - How to determine position (x,y) relative to the page of every character inside spans through javascript? -

this simple can get. i have several spans randomly positioned on screen through like: $(".hidden:first").css('-webkit-transform','rotate('+((0.5-math.random())*40)+'deg)'); $(".hidden:first").animate({ left: '+=' + (((screen.width-800-224)/2) + math.random()*800), top: '+=' + (50+math.random()*600) } [...] and later on iterate through every char of every of elements (that randomly position , have random rotation), , need discover (x,y) position of every character on screen can colorize it, forming draws according functions. is achievable? remembering want (x,y) position of each -character- of span, not (x,y) of span itself. inexperienced @ javascript. edit: answering own question: managed needed wrapping every single letter inside <span> , later accessing .offset().left , .offset().top through jquery. bad? :p thanks. fernando. something might started http://jsfiddle.net/qgrwk/

django-registration - how do i change example.com in the email? -

i have django-registration setup , sends emails - yay! however, it's decided ace call site "example.com", not name decided use. cool name, not me. how change example.com else? read somewhere go admin page - spoiler alert - i've never used admin page in django , not actively planning on (but maybe someday?) so go admin page - /admin/sites/site/ - , sure enough can see "example.com" , "domain name". what? added sites domain name , "display name", how select use it? deleted example.com! however, email insists on still sending out example.com. sites read "use admin", don't know if maybe admin broken (which odd, haven't touched it) or if there link i'm missing? any ideas? the entry saw on admin/sites/site/ page, example.com , domain name , 1 should edit quickest results (instead of adding new site object). what's happening? in settings file, django automatically defines site_id property when create pr...

javascript - Phonegap deviceReady not firing -

please excuse me if simple overlooking. making first foray app development using phonegap/cordova platform, appear stuck @ first hurdle. deviceready listener doesn't appear firing. my code looks so: alert('0'); document.addeventlistener("deviceready", function(){ alert('1'); db = window.opendatabase("testproject", "1.0", "phonegap test", 200000); alert('2'); if (dbcreated){ alert('3'); db.transaction(getdata, transaction_error); } else { alert('4'); db.transaction(populatedb, transaction_error, populatedb_success); } }, false); the initial alert('0') (put in make sure connecting file) firing nothing else happening. in post on here. else similar problem promted try document.addeventlistener("deviceready", devicereadyfunction, true) solved issue them, not me. as side question, how go debugging javascript , inspecting clientside databases in phonegap development? when developing w...

ember.js - Action Helper in Ember JS not calling function -

<a class="btn btn-primary" href="#" {{action "togglestatus"}}><i class="icon-plus icon-white"></i> add staff</a> this in view template called stafflist.handlebars. content follows <div class="page-header"> <h3>{{staff.title}} <small>list of users has access application</small></h3> </div> <div class="commands pull-right"> sta <a class="btn btn-primary" href="#" {{action "togglestatus"}}><i class="icon-user icon-white"></i> {{staff.btntitle}}</a> </div> <div class="pull-left"> <input type="text" class="search-query" placeholder="search"> </div> <table class="table table-striped table-bordered"> <thead> <tr> <td>name</td> <td>id</td> </tr> <thead> <tbody> {{#each sta...

javascript - Speech recognition in browsers other than Chrome? -

how can access microphone using javascript or html5 without using flash? made work in chrome using webkit-speech . need in other browsers. answers appreciated. this feature proposed google, , appears supported in products. see: https://stackoverflow.com/a/6619632/1504847

ruby on rails - How to set Devise to require one of email or username to be populated for saving? -

i followed this: https://github.com/plataformatec/devise/wiki/how-to:-allow-users-to-sign-in-using-their-username-or-email-address which works. can login either :username , :password or :email , :password. however, when creating accounts in console, if leave email blank, validation error. apparently email still required create user. i'd able create user using :username , :password, or :email , :password. please try adding following user model: def email_required? false end you may need create migration allow email column on users table null ( in case not null-allowed column already): change_column :users, :email, :string, :null => true edit : all have left ensure @ least username or email present. can setting following validation statement: validate :username_or_email_is_present def username_or_email_is_present if self.username.blank && self.email.blank? errors.add(:base, "email or username must set") end end

How to make a shell call from within a MySQL function or Trigger -

i have table records positions (gps) , fires insert trigger, check if new point inside or outside of area, based on result need notify (send email or sms). i able detect trigger need send notification able make shell call or http url call , send email. http://myserver.com/sendemail.php?to=email@address.com&subject=new+messaje&body=you+are+inside if not posible how can / better approach. thanks database triggers not right place sort of application logic. correct place logic in application, you're inserting data table. (conveniently, application better situated send mail database is.)

audio - Playing sound with AudioClip in Java - JackRouter error? -

Image
i'm relatively new java, though i'm delving little bit further in here. i'm creating program displays button of chicken, , upon clicking button, audioclip of chicken clucking played. simple, seems, yet can't audio work @ all. i'm using audioclip try accomplish this. book i've been using teach myself, [i]introduction java programming[/i] (eighth edition) y. daniel liang, tells me can use audioclip despite in non-applet program despite location. i'm having trouble getting work, though, here's have far. i'll give code , give error i'm receiving. i'm temporarily on mac, way, , haven't had chance try on windows. don't know why affect anything, there go. //this class plays sound. main class follows. import javax.swing.japplet; import java.applet.*; import java.net.url; public class chickensound extends japplet { private audioclip chsound; //creates audioclip public chickensound() { url url = getclass().getresource("resources/chic...