Posts

Showing posts from April, 2010

How do I detect the user’s browser and apply a specific CSS file? -

i need detect browser , apply matched css file. i have created 3 css files: __ie.css, ff.css, opera.css. need detect browser in order include one. i know <!--[if ie]> <link rel="stylesheet" href="css/ie.css" type="text/css"/> <![endif]--> but how do same firefox , opera/chrome? if have detect browsers apply css, might want rethink css before going browser-specific stylesheets. takes 1 browser mimic another's user agent string, or new version released, , breaks. use current standards , validate code ( http://validator.w3.org/ ), , you'll have worry far fewer cross-browser issues. using <!--[if ie]><![endif]--> without version number break layout in later versions. that being said, if want style page differently based on css features available, take @ modernizr . way, you're checking features, won't broken if new version of browser released. if else fails , need detect visitor...

android - Sensors persistence approaches -

i'd save sensors accelerometer, gyroscope, etc data , don't know what's best approach using fast or game selection. example, can think of saving 10 seconds of data in memory, , making batch insert database not saving @ rate of 20ms database , block phone, don't know how time take bath insert of 1000 records. other approach? goal @ desired time records in database sent specified web service. in advance. guillermo. i did similar when kept 5000 events in memory , printed out console afterwards on iphone offline research. besides sluggish behaviour of iphone console in general worked out pretty good. so need web service , bunch of user data? (i hope users know big brother watching them ;-) well, if should consider using compression , send out binary data, expecially if users not connected wlan. kay

How to screenshot website in JavaScript client-side / how Google did it? (no need to access HDD) -

Image
this question has answer here: using html5/canvas/javascript take screenshots 2 answers i'm working on web application needs render page , make screenshot on client (browser) side. i don't need screenshot saved on local hdd though, kept in ram , send application server later. i researched: browsershots alike services... mechanized browsers... wkhtmltoimage... python webkit2png... but none of gives me need, is: processing @ browser side (generate screenshot of page). don't need saved on hdd! just... ...send image server further processing. capturing whole page (not visible part) eventually came upon google's feedback tool (click "feedback" on youtube footer see this). contains javascript jpg encoding , 2 other huge scripts can't determine do... but it's processed on client side - otherwise there no point puttin...

c# - Programmatically changing button label in Monotouch -

i made .xib button, , referenced outlet "btnacties" when following (at given time) in back-end c# code btnacties.titlelabel.text = "this new label!"; when build , run app, label on button changes "this new label", then, if touch button, label reverts 'default' text set in .xib file. how change label on monotouch uibutton , keep happening? when want set text on uibutton, not altering text of textlabel property. calling settitle method, passing second argument, button state title set @ runtime. chetan bhalara's answer correct, here c#/monotouch equivalent: btnacties.settitle ("title", uicontrolstate.normal); they way doing right doesn't work, because label's text changing internally whenever needed, title set in interface builder (if have set it), in case when tap button.

ef code first - EF codefirst delete all child objects in a many-many scenario? -

how delete child objects in in many many scenario? example, i'd delete roles belonging user . i'm using ef code first. first must select roles , remove user instance roles collection. save var usersroles = user.roles.tolist(); usersroles.foreach(role => user.roles.remove(role)); context.savechanges(); // add new roles user ps. code may not exact, logic should use acomplish this.

blackberry - Help displaying png files which require scrolling/zooming and sufficient image quality -

we attempting port simple application android/iphone blackberry. application tool allows user navigate , view png files pages in reference manual. on iphone/android, used webviewer view images. images range in size 500x900 900x1500. works great on android/iphone. tried same thing on blackberry (curve, storm, torch: 5.0, 6.0) blackberry browserfield not appear scroll horizontally when image zoomed. tried using zoomscreen, image quality poor manual pages unreadable. does have suggestion how can implement functional viewer of these images allows zooming/scrolling , provides readable image quality? i received answer on blackberry forum appears work: you seem use mainscreen default scrolls vertically not horizontally. remedy that, create this: mainscreen myscreen = new mainscreen(vertical_scroll | horizontal_scroll); or, if extend it, put first line of custom screen constructor: super(vertical_scroll | horizontal_scroll);

c - linux kernel step by step -

i know c language.my goal read linux kernel.so languages should learn(write books too) before start reading kernel , there book reading linux kernel this book little outdated, understanding linux kernel amazing reference. give crash course in i386 features make lot of kernel facilities possible (such mmu , how interrupts work. operating systems, it's hard understand hardware ends , os begins), , reference lot of critical source directly. also, lwn kernel article index more up-to-date references. one way start come simple feature you'd add kernel , start hacking away @ it. (something did in college count how many times each process got preempted , export value via /proc file system. taught me lot scheduling, /proc, process structure, , many other facilities). recommendation, in vm unless plan reboot every fifteen minutes. for ad hoc questions, searching google works, or asking questions on irc. (respectfully, of course.)

XNA C# Problem reading directory content -

i've started developing of card game xna had problems reading cards inside cards directory inside content. i've tried following code: string[] nomecartas = directory.getfiles(@"cards"); but retrieved error saying not possible find part of path: não foi possível encontrar uma parte caminho 'c:\users\serafim\documents\visual studio 2010\projects\jogosuecaonline\jogosuecaonline\jogosuecaonline\bin\x86\debug\cards\'. i checked path , it's wrong, correct path should be: c:\users\serafim\documents\visual studio 2010\projects\jogosuecaonline\jogosuecaonline\jogosuecaonline\bin\x86\debug\content\cards\ is there other way read directory content xna or how can fix this? try: directory.getfiles(@"content\cards");

entity framework - Using Block in Asp.net -

i have doubt using(){}. know uses idisposable interface. if write in linq entities: using(objectconext context=new objectcontext()) { throw new exception(); } will objectcontext still disposed , existing connection closed or remain there alive. thanks, gaurav the using statement expands try finally block. when exception thrown, finally block in using statement should execute. from http://msdn.microsoft.com/en-us/library/yh598w02.aspx : the using statement ensures dispose called if exception occurs while calling methods on object. what happens next matter. spender points out in answer, datacontext has no obligation close connection using, nor need concerned (since datacontext should manage connection you). under conditions, thrown exception can swallowed silently try finally block. see here: http://www.digitallycreated.net/blog/51/c%23-using-blocks-can-swallow-exceptions . shouldn't affect you, though.

asp.net - How do I get <%= Html.Encode(item.name) %> in the title and head of page elements -

how <%= html.encode(item.name) %> in title , head of page elements i wanting use content place holder - title content, , main content. each time try add these in elements error saying not allowed. <h2>performances :<%= html.encode(item.venue) %></h2> this have been doing wont work can please query, thanks. remove runat="server" attribute <head> tag. it's legacy left ol' days of webforms has no viable meaning in mvc forgot remove default template. also if item variable not available in masterpage use content placeholder redefined in each view if variable part of view model available in views.

sorting - In python, how would I sort a list of strings where the location of the string comparison changes? -

i have list of strings have 2 dashes separating text like: wednesday-morning-go bowling sunday-really late @ night-sleep july-noon-bbq i'd sort list in alphabetical order in python last part of string--the 2nd dash , on. there way in python? e.g. want list after sorting. july-noon-bbq wednesday-morning-go bowling sunday-really late @ night-sleep (i'm using python 2.6.) you can use key attribute list.sort() : a = ["wednesday-morning-go bowling", "sunday-really late @ night-sleep", "july-noon-bbq"] a.sort(key=lambda x: x.split("-", 2)[-1]) print prints ['july-noon-bbq', 'wednesday-morning-go bowling', 'sunday-really late @ night-sleep'] note split() call allows more 2 dashes. every dash after second 1 ignored , included in third part.

python - if __ and __ in ___ then -

i trying create script loops through list. i need through finite list (400) of competency identifiers (e.g. 124, 129 etc - normal ints ) i have dictionary records competencies each user has. key user name , value each key list of integers (i.e. competencies users have) for example user x - [124, 198, 2244 ...] user y - [129, 254, 198, 2244 ...] i looking compile matrix highlighting how each competency occurs every other competency - adjacency matrix. for example in above examples competency 198 has occurred competency 2244 on 2 occasions. whereas competency 254 , 124 have never occurred together. i using code: fe = [] count = 0 competency_matches = 0 comp in competencies_list: common_competencies = str("") comp2 in competencies_list: matches = int(0) person in listx: if comp , comp2 in d1[person]: matches = matches + 1 else: matches = matches common_competencies = str(common_competencies) + str(ma...

mysql - Problem with mysql2 adapter "group" statement when writing queries -

when run following query in ruby: transaction.all(:select => "created_at, sum(amount) amount", :group => "created_at.strftime('%y-%m-%d')", :order => 'created_at') i following error in mysql2 (works in mysql): activerecord::statementinvalid: mysql2::error: function created_at.strftime not exist: what need group transaction on date(without time). rewrite statement, there can this? thanks! there date function want. # mysql> select date('2003-12-31 01:02:03'); # -> '2003-12-31' # # used in query: transaction.all( :select => "created_at, sum(amount) amount", :group => "date(created_at)", :order => "created_at")

Chrome Extension to get URL and append ending -

i new js , chrome extentions , trying make chrome extension gets current tabs url , adds '&flash=on' @ end. code doesn't seem want work right manifest.json { "name": "flashon chrome", "version": "0.1", "description": "changes default flash player", "permissions": [ "tabs"], "content_scripts": [ { "matches": ["http://www.stream.com/*"], "js": ["script.js"] } ] } script.js function updateurl(tab){ var currenturl = tab.url var newurl = currenturl.replace(currenturl + "&flash=on"); chrome.tabs.update(tab.id, {url: newurl});} chrome.browseraction.onclicked.addlistener(function(tab) {updateurl(tab);}); its streaming site has html5 video , flash video flash accessible adding &flash=on end of url not sure you're trying accomplish here: trying...

fitting a GUID field into a smaller field without losing uniqueness -

i need send guid pk field (length = 36) downstream system accept 20-char long. cost-prohibitive increase length of field in downstream system. if truncate field lose uniqueness. any way stuff 36 characters long guid varchar(20) field without losing uniqueness? thank kathy since varchar(20) 20 bytes , guid 16, should able fit in ascii85 -encoding binary guid.

Help with atk4-web, atk4-example ver. 4.03 -

i don't can find help. none forums atk4. can me, please? atk4-web (4.0.3): how run atk4-web localy, site dump (mysql database)? mean error: no such tag (version) in template object agiletoolkitweb(agile_project). tags are: page_title, page_title#1, seo_keywords, seo_keywords#2, seo_descr, seo_descr#3, template, template#4, template#5, template#6, template#7, template#8, template#9, os, os#10, js_include, js_include#11, document_ready, document_ready#12, section, section#13, template#14, menu_about, menu_about#15, page, page#16, menu_doc, menu_doc#17, page#18, menu_develop, menu_develop#19, page#20, menu_services, menu_services#21, page#22, menu_download, menu_download#23, page#24, menu_blog, menu_blog#25, page#26, link_comparison, link_comparison#27, link_example, link_example#28, link_tour, link_tour#29, content, content#30, tabcontent, tabcontent#40 d:\www\atk4web\atk4\lib\smlite.php:341 atk4-example (4.0.3): why page has not javascrip included, when allow ->chec...

Java: JOOQ persistence framework performance and feed back -

i've stumbled on nice sql builder framework, called jooq . btw, in russian jooq sounds noun meaning "bug" (as insect), "beetle" ;) if have feedback jooq, it's performance , such, please share. links blogs jooq welcome. i think should answer here because started using jooq 1 , half months ago have experience it. i wanted use tool jooq because: orm overkill in current project (distributed calculations platform cluster) since need read , write separate fields db, not complete table rows , of queries complex enough not executed simple , lightweight orms. i wanted syntax autocomplete queries don't need keep whole db in mind i wanted able write queries directly in java compiler check basic query syntax on build. i wanted queries type-safe couldn't accidentally pass variable of 1 type, 1 expected. i wanted sql, wanted convenient , easy use well, jooq able achieve that. main requirement jooq handle complex enough queries (nested, ...

javascript - jqplot zoom - happens only if zoomed till the borders -

i facing issue zooming using jqplots. i have graph multiple y-axes. have following lines of code performing zoom: cursor: { showverticalline: true, //showtooltip: true, followmouse: true, showtooltipdataposition: true, tooltipformatstring: '%s x:%s, y:%s', zoom: true, constrainoutsidezoom: false, clickreset: true } i able zoom above. however, zoom happens when drag zoom area 1 of borders. if try zoom somewhere within canvas, not zoom. can tell me going wrong? thanks, s. i have same problem. in fact, problem when zoom inside canvas browser considers click inside canvas , execute function clickreset. when mouse finish outside canvas consider click outside , doesn't execute function. tried on ie9 , works because doesn't consider click during zoom. i think bug in jqplot library. i searched many hours , didn't solve problem. hope has solutio...

c# - Watin & IE9 - Cant click ok buttons -

i'm using watin navigate through large number of different websites, , i'm using great solution here automatically click ok on javascript , ie boxes popup. the problem is, solution works great ie6-ie8, no longer works ie9. does have suggestions on how ie9 auto click/close prompts? (i'm using latest watin release, , code below) public class { public something() { ie browser = new ie("about:blank"); addhandlers(browser); .. stuff browser } //just click ok private void addhandlers(browser browser) { browser.adddialoghandler(new watin.core.dialoghandlers.alertandconfirmdialoghandler()); browser.adddialoghandler(new watin.core.dialoghandlers.alertdialoghandler()); browser.adddialoghandler(new watin.core.dialoghandlers.certificatewarninghandler()); browser.adddialoghandler(new watin.core.dialoghandlers.closeiedialoghandler(false)); browser.adddialoghandl...

Mootools calling class method onSuccess Ajax -

i'm trying achieve following: user clicks on element , cmove function invoked (works) cmove passes js object ajax method (works) ajax method submits object move/test controller (php/codeigniter) (works) controller returns json data (works) onsucces calls move method stuff (no chance calling method) so, how can call move method out of onsuccess? , there better way of pushing moveobj around? var plane = new class({ implements: options, options: { action: null }, initialize: function(options) { this.setoptions(options); $('somelement').addevent('click', this.cmove.bind(this)); }, cmove: function(event, action) { moveobj = new object(); moveobj.x = 123; this.ajax('cmove', moveobj); }, move: function(moveobj) { console.log("yippe!"); // not getting here :( }, ajax: function(action, obj) { resp...

php - Checking If MySQL Rows Returned>10 and if so running some code, if not running a different piece of code -

i have code below supposed check database entries username working when try add code check if rows returned greater 10 , run code limit number of rows 10 , if not run piece of code display rows. code: mysql_select_db("blahblah", $con); //connect database.. $username = basename(dirname(__file__)); $username = mysql_real_escape_string($username); $checkres = mysql_query("select count link, notes, titles, color links username='" . $username . "';"); if ($checkres>10) { $resultsmall = mysql_query("select link, notes, titles, color links username='" . $username . "' limit 10;"); while ($rowsmall = mysql_fetch_array($resultsmall)) { //loop extract($rowsmall); $htmlsmall .= " //code goes here format results "; echo $htmlsmall; //display results... } } else { $result = mysql_query("select link, notes, titles, color links us...

php - How to send the content of an external file to printer? -

i want print (printer, not screen) content of file via php script. how do this? update php cannot access hardware. not considered "possible." see: so "how "print" paper" how print directly printer however, first link shows, done javascript. can output javascript in way similar methods shown on first link force browser show print dialog box. original you can use file_get_contents print files variable or output stream. $filecontents = file_get_contents("myfilename.txt"); print $filecontents; you can include files php interpretation.

html - rounded corners on a thumbnail -

is possible make corners of thumbnail rounded using css? edit - html starting point is: <img src='test.jpg' width='50' height='50' /> it has no css on @ start , wanting round corners little... edit+note: moz-border method doesn't round corners of image itself, hoping for, instead rounds corners of boarder square around images. looks ok... to expand @clayton's answer: you can natively in any modern browser: -moz-border-radius: 5px; border-radius: 5px; the vendor prefix -moz disappear soon. see this jsfiddle see in action. notice, also, rounding applied directly <img> element. this works in current versions of 5 major browsers.

loops - C# Make Program Wait For Button To Be Pressed -

i want make program wait button pressed before continues, tried creating while loop , having loop until button clicked , sets bool true while loop end, made crash while (!redpress) { //i'd wait here } redpress = false; it doesn't matter whether or not while there, long program waits button press before setting "redpress" false... ideas? use events - it's they're designed for. you don't need use boolean variable in button_click event handler call code: private void button_click(object sender, eventargs e) { // code need execute when button pressed } as @trickdev points out need subscribe event if use events window in visual studio add necessary code - including empty handler - you. with event driven programs waiting until next "thing" happens. in case (if i've understood application correctly) when start program should tell firs...

routing errors in rails application -

so i'm getting error in rails app: no route matches {:action=>"edit", :controller=>"parties"} in routes.rb file have set: resources :parties under directory views/parties/show.html.erb view show.html.erb contains line: <%= link_to "edit party details", edit_party_path %><br /> this works. however, under directory views/users/show.html.erb contains line: <%= link_to "edit parties", :controller => 'users', :action => 'edit_parties' %> inside edit_parties.html.erb have loop prints out user's parties , link edit them. link looks this: <li><h2><%= link_to party.title, edit_party_path %></h2><%= party.description %></li> this error occurs. why edit_party_path not work here, works above? because edit_party_path inside edit_parties.html.erb has no id grab? i think diagnosis correct. try instead (note argument edit_party_path)...

How can I create "upload" files with web2py -

i have app running on web2py. app want store lot of files database each user, can either upload own computer or can create online , save. these files can either text or binary files, if created in app, text. have 2 ways files come in have handle: 1) uploads through form. database has "file" field of type "upload" store using: db.allfiles.insert(filename=filename, \ file=db.allfiles.file.store(file.file,filename),user=me) this creates file unique string attached name in uploads directory. solution pretty easy. 2) i need store files come in strings via json call . not sure how create "upload" type files , give them unique names in uploads directory. can give insight? thanks i think can incoming data, turn in-memory stream , store @ 1) import stringio filehandle = stringio.stringio ( jsonvar )

java - How do I Click a JButton without the user Clicking it? -

i have jbutton , when player clicks it tell action listener button clicked. want know is there command or acts if player clicked button. like tic tac toe, have 2 players can play against each other, want add option computer player vs human player. since computer cant click button, lost. edit: easy gridbutton2.click() (name of button).click(); pretty much. need use doclick() function. see the api more information.

javascript - strip decimal points from variable -

ok know easy floundering.. have series of variables have decimal point , few zeros. how strip variable goes 1.000 1 ? dont think important numbers generated xml file grabbing jquery ... var quantity = $("qty",this).text(); thanks in advance help! simply... math.round(quantity); ...assuming want round 1.7 2 . if not, use math.floor 1.7 1 .

c# - Unexpected empty sequence in linq to sql result -

i have simple query deletes entry table cb_user_schedule deleted = (from x in db.cb_user_schedules x.scheduleid == currentscheduleid select x).single(); db.cb_user_schedules.deleteonsubmit(deleted); db.submitchanges(); however, first statement returns sequence contains no elements . can see when executes value of currentscheduleid in fact number , when directly execute select * cb_userschedules scheduleid = 3 return row. why statement not finding row in database? check emitted sql built-in linq-to-sql logging (hook textwriter log property on datacontext) or sql profiler. more you've got datatype mismatch or key issue in dbml (ie, doesn't match reality in db , mapper barfing on it). run large , complex site exclusively on l2s, , these kinds of issues related broken dbml.

array in C++ inside forloop -

what happening when write array[i] = '\0' inside loop? char arraypin[256]; for(int = 0; i<256; i++) { arraypin[i] = '\0'; } the program attempts access memory @ location of <base address of 'array'> + (<sizeof array element> * 'i') , assign value 0 (binary 0, not character '0'). operation may or may not succeed, , may crash application, depending upon state of 'array' , 'i'. if array of type char* or char[] , assignment operation succeeds, inserting binary 0 @ position 'i' truncate string @ position when used things understand c-style strings ( printf() being 1 example). so if in for loop across entire length of string, wipe out existing data in string , cause interpreted empty/zero-length string things process c-style strings.

dialog - How should I use showDialog() and onDialogCreate() in Android? -

i read this document don't understand. it says can use showdialog() show dialog , system call ondialogcreate(). but in next section, says should use alertdialog.builder's create() create dialog. i tried alertdialog.builer's show(), works , dialog popup. but... should call showdialog() , ondialogcreate()? here discussion : dialog.show() vs. activity.showdialog()

mysql - What method should be used for rails session storage? How to decide? -

what best method storing session data on rails? depends on needs key factors go decision , ideal session stores different scenarios? security should concern. bear in mind stored on client side (such cookies, form post parameters, parameters, etc.) can modified using browser proxies. so, validate comes through browser. encrypt values in cookies or form post parameters wel. also, steve mentioned, cookies should used small values. the default file based method if you're not going running on cluster of servers, or if are, if can tolerate users' sessions getting lost if server goes down (they have log in). vast majority of apps, acceptable. you'll need configure load balancer "sticky sessions", means given user bound single server. can make load balancing bit more difficult though, you'll find many users bound single server while server sits there idle. if require shared session state across cluster, have couple of primary options. if tra...

Creating a custom PHP template -

i created custom php templating system , way built seems, well, inefficient. 3 main goals template to: pull site-wide html elements template.tpl include. be able dynamically assign content in template.tpl (like <title> or <script> ) be efficient , scalable possible. in end, template system looked this: randompage.php <?php // declare page specific resources $pagetitle = "random sub-title"; $pageresources = "/css/somerandomcss.css" $pagecontent = "/randompage.tpl" // include generic page template include dirname($_server['document_root']).'/includes/template.tpl' ?> randompage.tpl <h1><?=$pagetitle?></h1> <p>some random page's content</p> template.tpl <!doctype html> <html lang="en"> <head> <title>my site -- <?=$pagetitle?></title> <link href="/css/styles.css" rel="stylesheet" type="text...

c# - How to have the parent UIView Appears ABOVE it's UIImageView sub-view -

i have class extends uiview, , has uiimageview added subview when uiview constructed. override draw method (aka drawrect) , draw on current cgcontext fine if don't add uiimageview or if set opaque false , backgroudcolor clear , leave image set null (aka nil). once set backgroundcolor of uiimageview real color, or set image on uiimageview other null draw being drawn under uiimageview. this seems odd if if draw on parent's context should appear above sub views. seems stack upside down 1 think. seems 1 expect highest layer parent sub views being added lower layers in order added. doesn't seem case. i tried sending sub view front , didn't change anything. basically if parent view opaque false , it's background color clear expect shapes or lines draw on it's context in draw method shown on top of subviews may have. how can draw on parent view , while showing below being drawn subview? is there documentation on apple's site explains z-order of p...

javascript - How to delete an item from array of objects? -

var arr = [ {id:2,date:'2010-10-03',des:'goodday'}, {id:3,date:'2011-02-13',des:'badday'}, {id:4,date:'2011-04-03',des:'niceday'} ]; now want delete {id:3,date:'2011-02-13',des:'badday'} , , arr should be var arr = [ {id:2,date:'2010-10-03',des:'goodday'}, {id:4,date:'2011-04-03',des:'niceday'} ]; how should do? assume id fields in objects unique can following delete it. function use splice : var arr = [ { id: 2, date: '2010-10-03', des: 'goodday'}, { id: 3, date: '2011-02-13', des: 'badday'}, { id: 4, date: '2011-04-03', des: 'niceday'} ]; for(var i=0; i<arr.length; ...

Javascript doesn't work correctly when css class is used more than once? -

previously, asked how center align image (w/ dynamic width) within div , replied code: http://jsfiddle.net/wdzx4/6/ it's working correctly. however, when try using same class image, other image no longer vertically centered: http://jsfiddle.net/b4bbd/ you see, now, 50x50 black image higher should be. noticed first image gets aligned correctly. if add other images different width , height (using same class) after that, misaligned. could me find problem i'm not familiar javascript. you need wrap javascript matching elements, instead of calculating height 1 , applying all: $('div.container_img img').each(function() { var $img = $(this); var h = $img.height(); $img.css('margin-top', +h / -2 + "px"); });

css - HTML email - Outlook 2007+10, unrelated tables aligning -

i've got dilemma have never come across before has stumped me. in design have built outlook 07&10 aligning 2 entirely unrelated table rows. complex email layout, , contains lot of tables. content in left column sticking bottom (or top of sibling) hr tag depicted here: <tr><td height="20"></td></tr> <tr><!-- start of sidebar product (horizontal)--> <td> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td width="170"> <a href="" title="inline product 2" style="text-decoration: none;"> <!-- product image --> <img border="0" style="font-family:arial,helvetica,sans-serif;display:block" src="sidebar-beer-tbc.jpg" alt="south island marlborough sauvignon blanc" width="...

aspectj - How to get the caller method information from Around advise -

thisjoinpoint can current method information, anyway caller method information? you can try special variable thisenclosingjoinpointstaticpart holds static part of enclosing joinpoint. mentioned here (example) , here (docs) or if using annotation-based aspectj, pass following advice method's parameters, e.g.: @before("call( /* pointcut definition */ )") public void mycall(joinpoint.enclosingstaticpart thisenclosingjoinpointstaticpart) { // ... } mentioned here

rails not picking session data -

i implementing payment gateway in app. this: user fills form necessary details, along field containing return_url(say http://myapp.com/ebs _payment/ebs_response?dr={somedata}) , submit form secure payment site. after transaction complete, secure site puts encrypted data param {dr} , user redirected return url. problem here is, when user returns app return_url , application fails pick session data , returns nil value. before submitting form, put object @fdpaymentdets in session. here controller: class ebspaymentcontroller < applicationcontroller #before_filter :login_required,:check_user_authenticate #access_control [:ebs_response] => ('user') def ebs_response @fdpaymentdets = session["fd_payment_details"] @deal = deal.find(@fdpaymentdets.deal_id) @categories = find_all_categories end private def find_all_categories @sp = sitepreference.find(:first) category.find(:all,:limit => @sp.categories_display_li...

linq - Currying Expressions in C# -

i trying build expression tree can feed linq2sql generate nice clean query. purpose build filter takes arbitrary set of words , and not (or or , not) together. because want vary fields search on preferably want compose list of expresssion<func<t, string, bool>> 's (where t entity operating on) calling variety of helper functions. receive array of words , loop though them , build expresssion<func<t, bool>> (negating expressions necessary) can feed .where statement. i have been using linqkit predicatebuilder code deals single parameter expressions. however, has provided me groundwork own attempts. aiming this: var e = (expression<func<entity, string, bool>>)((p, w) => p.somefield.tolower().contains(w)); var words = new []{"amanda", "bob"}; var expr = (expression<func<entity, bool>>)(p => false); // building or query foreach(var w in words) { var w1 = w; >>>>expr = expression.lambda...

mysql - My SQL table is missing mysteriously -

on live server table not found mysteriously. twas working got sql error of missing table. looked through phpmyadmin found table missing mysteriously. happened first time in mysql life. can please tell me happened, why table vanished mysteriously? maybe sql injection attack dropped table? have checked database logs?

How can I limit a html input box so that it only accepts numeric input? -

i have html input box, numeric data data. how can enforce that? you can use html5 validate type of input without using javascript. however, method not (yet) supported browsers. <input type="number" name="quantity" min="1" max="5"> use following attributes specify restrictions (as described here ): max - specifies maximum value allowed min - specifies minimum value allowed step - specifies legal number intervals value - specifies default value

perl - How do I get the IP address of the server a request is coming from? -

how ip address of server request coming from. here's scenario; i have 2 servers - client|server. how can detect ip of client server in perl you need getpeername . please perldoc.

sql server 2005 - Delete all records from all tables of database -

is there anyway delete records tables of database yet keeping constraints. i used script available on net fails foreign keys defined. please provide step step illustration i'm new databses. thanks! create procedure sp_emplyalltable exec sp_msforeachtable ‘alter table ? nocheck constraint all’ exec sp_msforeachtable ‘delete ?’ exec sp_msforeachtable ‘alter table ? check constraint all’ go

bash - What are some good ways to delete files with blank(invisible) names? -

i discovered files blank names in code repository, don't know how find them , delete them. assuming have access find command, find . -regex ".*\/[[:space:]][[:space:]]*" -exec rm {} \; if you'd check before deleting, $ mkdir -p c/d # make empty filenames $ touch " " " b" "a b" $ touch "c/ " "c/ b" "c/a b" $ touch "c/d/ " $ touch "c/d/ " # echo filenames markings $ find . -regex ".*\/[[:space:]][[:space:]]*" -exec echo '{}<blank' \; ./ <blank ./c/ <blank ./c/d/ <blank ./c/d/ <blank note: surprise, works full-width spaces.

asp.net mvc - Server Error in '/' Application. with same route -

i've been trying figure out can't find answers problem. problem having url: localhost:343434/lev/details/1/4/con/2 this url return "server error in '/' application". know action return value theese parameters. however, if use same route other parameters: localhost:343434/lev/details/3/4/fhs/5 it call action , return result. "server error in '/' application" appears when using "con" the outpus this: the resource cannot found. description: http 404. resource looking (or 1 of dependencies) have been removed, had name changed, or temporarily unavailable. please review following url , make sure spelled correctly. requested url: /lev/details/1/4/con/2 and route: routes.maproute( "levroute", "{controller}/{action}/{id}/{source}/{levtyp}/{levid2}/{page}/{order}", new { controller = "lev", action = "details", page = ...

Click gmail signout link using Watin -

i using ie8 , ie9 on 2 different machines , want click signout link of gmail account. watin unable find signout link , gives me error. could please me , let me know how can achieve this. thanks yasir expecting have created browser instance think trick: var signoutbtn = browser.frame("canvas_frame").link(find.bytext("sign out")); signoutbtn.click(); btw sure update watin 2.1 supports frames in ie9 properly.

php - In jQuery uploadify show the images as thumbnails BEFORE the upload by the user's filepath -

i'd make uploadify upload server, , make thumbnails user's images on fly. i need filepath each upload. parameter found in javascript substringed filename. instead of ohmygoditsantaclaus.jpg want full path c:/etc/etcetera/daddy/ohmygoditsantaclaus.jpg . if have this, can make div container put image it, , resize css. thanks help. ps: used uploadify v1.6.2 here jquery uploadify v.1.6.2 , uploader.fla using. you can't access full path either javascript or flash, like: c:/etc/etcetera/daddy/ohmygoditsantaclaus.jpg it's security thing. also, if could, sure heck can't next thing want do: if have this, can make div container put image it, , resize css. you can't access random images on user's hard disk using file:// uri , place them on webpage. you can instead use http://www.plupload.com/ - once user has selected images upload, can resize images client side. if want show thumbnails before uploading, know flash c...

iis - Cannot get ASP.Net to serve any pages under IIS6 -

i trying set instance of live website customer evalulate, unable server serve asp.net pages @ all. i know bit of noob question, have set these servers hundred times , know usual gotchas, have done of following no avail, , example have created simple test page writes out hello world, , i'm still unable serve.. this windows server 2003 r2 spii i have registered asp.net using aspnet_regiis.exe -i i have enabled web service extensions i have created virtual directory, , created application i have set version of asp.net virtual directory use i have created new app pool , given administrator permissions. i have run auth diag microsoft , , error authentication check, blank i have given full control everyone group folder i have tried creating new website different port, same problem in fiddler following repsonse when loading asp.net page : http/1.1 504 fiddler - receive failure content-type: text/html connection: close timestamp: 09:43:01:0634 readresponse() failed...

ibatis.net datetime and dynamic sql -

how can test if property of type datetime contains value on dynamic sql statement ibatis.net mapping file follow, not work <select id="select" resultmap ="congeresult" parameterclass="conge"> select * conge <dynamic prepend="where"> <isgreaterthan property="startdate" comparevalue="01/01/0001 00:00:00"> start_date >= #startdate# </isgreaterthan> </dynamic> </select> thanks in advance. try specifying date/time value in iso 8601 format http://en.wikipedia.org/wiki/iso_8601 . parsers correctly parse string representation. value parsed if type: comparevalue="0001-01-01 00:00:00"

c++ - Access a struct i unmanaged C code -

i have pile of c code (.exe) unmanaged (not compiled /clr). access/manipulate c struct in c code managed wrapper in c++/cli prefarably dll. new c++/cli, have make happen? unless know address of struct, it's not going happen. and knowing adderss depends heavily if defined global variable, local variable in function or allocated dynamically?

OpenGL 3.2 in Delphi 2009 using FastMM 4.97 problem with UBOs in FullDebugMode -

i'm sitting opengl 3.2 application in delphi 2009. when using fastmm 4.97 fulldebugmode defined ubos not data properly. fulldebugmode undefined works charm. example: setting viewport dimensions pointing 2 private integer fields, fwidth , fheight, in our render frame class. glbuffersubdata(gl_uniform_buffer, vuniform.offset, vuniform.size, @fwidth); i've been pulling hair on issue few days , don't know how proceed. i'm not expecting full opengl support here can come suggestion based on known differences between running in fulldebugmode , not. project settings: [compiling] optimization false stack frames true use debug .dcus true [linking] debug info true map file detailed os windows 7 64 bit. edit: found it! had nothing @ opengl. elsewhere in our codebase function returned pansichar using result := @ansistring(object.name)[1]; worked of time running since memory released unchanged. in fulldebugmode data overwritten $80 sequence when f...

date - Getting day of the week from timestamp using JavaScript -

how day of week timestamp in javascript? i'd timestamp specify, not current date. thanks var timestamp = 654524560; // unix timestamp in seconds var xx = new date(); xx.settime(timestamp*1000); // javascript timestamps in milliseconds document.write(xx.toutcstring()); document.write(xx.getday()); // day

Isn't this HTML5 date input supposed to have a spinner in Fx4 and Safari5? -

loading http://diveintohtml5.ep.io/examples/input-type-date.html <form> <input name="birthday" type="date"> <input type="submit" value="go"> </form> into fx4 , safari5 on xpsp3, expected see kind of enhancement up/down on type="number". do you? update: date picker appears in opera - nothing in safari5 or fx4 on xp "up" , "down" type="number" , not type="date" , isn't it? this page suggests, uis new types not yet supported in opera.

javascript - Redirection to a locale page with a Firefox extension -

i'd have page redirecting using javascript. i've tried document.location.href doesn't work local pages (stored in hard drive). know trick ? thanks, bruno doesn't it? i've tried following , works fine: <html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> </head> <body> <input type="text" value="" id="test"/> </body> <script type="text/javascript"> document.location.href = "file:///c:/dev/piccs/vb/binaries/"; </script> </html> tested in ie8 , chrome

timestamp - PLSQL-Parametric definition of group function -

i have table want apply aggregation functions having criteria grouping of spesific element of specific column. assume example below: timestamp site value 10:00 100 10:00 b 50 10:00 c 25 10:00 d 25 10:05 25 10:05 b 15 10:05 c 5 10:05 d 10 i want find average value grouping site , timestamp site a,b want estimated one, meaning wanted replace b a have , find average: timestamp site value 10:00 75 10:00 75 10:00 c 25 10:00 d 25 10:05 20 10:05 20 10:05 c 5 10:05 d 10 one way update table setting b=a , not such sophisticated solution if want in future group more sites you don't need update table. select case site when 'b' 'a' else site end site ,timestamp ,avg(value) sites group case site when 'b' 'a' else site end ...

java - make exe from jar using izpack -

hi make exe jar file using izpack in exe when install it shows izpack logo in exe file in top left corner please give me proper use of izpack open install.xml file , find <resources> tag. here find image path displaying on top left. change yours. :)

arrays - Simplify a php function whitch use FileMaker API -

i use filemaker api php take filemaker data in php. so, works well. simplify it. /** code correct , can't modify ***/ require_once ('inc/fm/filemaker.php'); require_once ('inc/fm/param_fm.php'); $modele="mura"; $id_folder=$_get["folder"]; $id_ouvrage=$_get["id"]; $findcommand =& $base->newfindcommand($modele); $findcommand ->addfindcriterion('id ouvrage', $id_ouvrage); $result = $findcommand->execute(); if (!filemaker::iserror($result)) { $records = $result->getrecords(); } else{ echo "no result"; } /*** end unmodify code ***/ when want show data use : $collection = $records[0]->getfield('collection book'); $title = $records[0]->getfield('title book'); $years = $records[0]->getfield('years book'); but have data in array. $data= array('collection' => 'collection book','title' => 'title book', 'years' =...

ruby - Accessing a Rails model name from within a lib file of the same method -

this may seem silly question have model named ad , have library name auto contains class ad(lib/auto.rb). #auto.rb lib file module auto class ad def initialize ... end def convert # here access model class ad # ::ad not work. requiring not work either. end end end does rails 3 store models under global namespace? am missing or defining auto::ad? if so, ::ad never work. use auto::ad or ad (from within auto module). if don't want auto namespace . remvoe module auto part in code.

php - Doctrine 2, decimal can only contain 14 digits -

edit: confirmed bug in doctrine 2 http://www.doctrine-project.org/jira/browse/ddc-1112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedcommentid=15724#action_15724 i have doctrine 2 entity , value mapped (with regular getter/setter): /** * @column(type="decimal", precision=40, scale=30) */ protected $somevalue; /** * @return decimal */ public function getsomevalue() { return $this->somevalue; } /** * @param decimal $somevalue */ public function setsomevalue($somevalue) { $this->somevalue = $somevalue; } when set value code, value gets written database correctly. but, , problem, when value (via getter or \doctrine\common\util\debug::dump() ), gives me number maximum 14 digits, , rounds value. read record default findbyid() . eg: value 1234567890.012345678901234567890123456789 have 1234567890.0123 eg: value 890.0123456789012345678901234567890123456 have 890.01234567890 i of course want digits, not 14. field ...

How do I use MsiGetProductInfo to get installed version number c# winforms 4.0? -

i'm trying installed version number of win fomrs application using msigetproductinfo function. try alter code found on post , wing ding looking text when alter call function so msigetproductinfo("{9806c9be-59d4-4dee-802f-0e492023de8a}", "installproperty_versionstring", builder, ref len); its 4.0 c# winforms project installed standard vs2010 setup project. client machines win 7 , win xp have checked return value of function? if returns error, it's possible buffer filled garbage. this list of possible returns, msdn page here return value error_bad_configuration configuration data corrupt. error_invalid_parameter invalid parameter passed function. error_more_data buffer small hold requested data. error_success function completed successfully. error_unknown_product product unadvertised or uninstalled. error_unknown_property property unrecognized. note msigetproductinfo function returns error_unknown_property if application bei...

mysql password not working -

possible duplicate: how reset mysql root password ? i executed query update mysql.users set password= password('123456') users='root' , host='localhost'; flush priviledges; and after mysql not running. phpmyadmin , mysql console both not working #1045 - access denied user 'root'@'localhost' (using password: yes) there's typo here: flush priviledges; should be flush privileges;

python - pysvn on a webserver -

are there web hosting providers have pysvn ( http://pysvn.tigris.org/ ) included in python modules, or allow add additional modules such can install myself? many thanks. if have shell access can install pretty home directory. make sure path install module added pythonpath environment variable. say /home/harry home directory, install pysvn /home/harry/lib in .bash_profile add: pythonpath=/home/harry/lib:$pythonpath export pythonpath login , log out again. put environment , python find modules in /home/harry/lib see python docs on modules more info on how python searches modules. the real caveat is, if host doesn't have files needed build pysvn (such svn header files), you'll have install them also. with said webfaction (which nice towards these things , python development) , question might better in webmasters.stackexchange.com

c# - How to unlock files in TFS? -

how unlock files in tfs? never enter foreach loop. why? local path , serverpath true: static void unlockfiles(string[] localpaths) { var serverpaths = getserverpaths(localpaths); var pendingsets = _sourcecontrol.querypendingsets(serverpaths, recursiontype.full, null, null); foreach (var pendingset in pendingsets) unlockitemsfrompendingset(serverpaths, pendingset); } static void unlockitemsfrompendingset(string[] serverpaths, pendingset pendingset) { foreach (var change in pendingset.pendingchanges) { if (serverpaths.contains(change.serveritem.tolower())) { var ws = _sourcecontrol.getworkspace(pendingset.computer, pendingset.ownername); if (ws.setlock(change.serveritem, locklevel.none) > 0) console.writeline("lock unset on {0}", change.serveritem); } } }

clrstoredprocedure - CLR Stored Procedure -

i wish use cryptography api in clr stored procedure. i have created clr stored procedure , written select statement sqlconnection conn = new sqlconnection(); conn.connectionstring = "context connection=true"; sqlcommand cmd = new sqlcommand(); cmd.connection = conn; cmd.commandtext = @"select * employee"; sqldatareader rdr = cmd.executereader(); now wish filter results using employee number stored in encrypted form in database going use cryptography methods. now stuck how go filtering records sqldatareader . i want return format sqldatareader , return multiple records clr stored procedure there 1 method sqlcontext.pipe.send() , method accepts sqldatareader objects. please guide me. i'm looking @ similar problem want manipulation before returning results. way can see @ moment use: // note need pass array of sqlmetadata objects represent columns // constructor of sqldatarecord sqldatarecord record = new sqldatarecord(); // use set m...

xml - How to index and search two different tables which are in same datasource using single solr instance(two different search fields no joins) -

i new solr. have couple of questions on solr indexing , searching: can configure index 2 tables( no relationship 1. books , 2. computers , both in same datasource) if want have 2 search boxes. possible defining 2 entities in 1 data-config.xml if yes please let me know steps. i guess can using 2 different data-config.xml files. need know how configure in schema.xml , corresponding changes. how configure solr index both pdf files , mysql on 1 solr instance. please me out , let know if there reference documents. 2 different tables no relation data-config.xml: <document> <entity name="topic" transformer="templatetransformer" pk="topic_id" query="select topic_id,topic_title,creation_date,updation_date,vote_count,....."> <field column=" doc_id " template="topic_${topic.topic_id} " /> <field column="doc_type " template="topic "...

salesforce - Sales force default access -

what default access specifier in sfdc? eg if declare class as: class myclass{ //code } then default access specifier class? you cannot define outer class without access modifier, must specify public or global. if try you'll compile error: save error: top-level type must have public or global visibility inner classes on other hand not require access modifier , private default.

oracle - How to keep cursors in v$sql_plan alive longer -

i'm trying analyse query execution plan in oracle database. have set alter system set statistics_level = all; such can compare estimated cardinalities , times actual cardinalities , times. now, i'm running statement in order display information. select * table(dbms_xplan.display_cursor( sql_id => '6dt9vvx9gmd1x', cursor_child_no => 2, format => 'allstats last')); but keep getting message note: cannot fetch plan sql_id: 6dt9vvx9gmd1x, child_number: 2 please verify value of sql_id , child_number; plan no longer in cursor cache (check v$sql_plan) the child_number correct when query being executed. also, when run dbms_xplan.display_cursor @ same time query, actual plan. jdbc connection closes preparedstatement after execution, maybe that's why execution plan disappears v$sql_plan . am getting wrong, or how can analyse estimated/actual values after execution? increase shared_pool create more...