Posts

Showing posts from September, 2011

.net - please get me started on querying DB with c# -

i need started accessing database c# please give me simplest example possible!! perhaps mysql database simplest example? please show me how connect mysql database , data if want use mysql, you'll need .net data provider mysql or mysql odbc driver. or install sql server express edition ( free download ). then walk through beginner tutorial, of there plenty on web: msdn tutorial here , one here , here , , here simple msdn sample covering ado, odbc, oledb. really there huge wealth of out there.

javascript - When should I use a semicolon after curly braces? -

many times i've seen semicolon used after function declaration, or after anonymous "return" function of module pattern script. when appropriate use semicolon after curly braces? you use semi-colon after statement. statement: var foo = function() { alert("bar"); }; because variable assignment (ie creating , assigning anonymous function variable). the 2 things spring mind aren't statements function declarations: function foo() { alert("bar"); } and blocks: { alert("foo"); } note: same block construct without semi-colon applies for , do , while loops.

Silverlight 4 Canvas.Left binding without canvas per item -

i'm getting performance issues code, mousing on canvas area laggy if leave in canvases within data template, no lag if take them out (but canvas.left bindings don't work ellipses in wrong place!) there way position these items without each 1 needing own canvas? <canvas> <itemscontrol itemssource="{binding path=spatialdata.trainevents.arrdepellipseoflines}" name="ctrlcharttraineventsarrdep" > <itemscontrol.itemtemplate> <datatemplate> <canvas> <ellipse width="{binding eventshape.width}" height="{binding eventshape.height}" stroke="{binding path=stroke}" strokethickness="{binding strokethickness}" fill="{binding path=fill}" canvas.left="{binding canvasplacement.x}" canvas.top="{binding canvasplacement.y}" /> </canvas> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol> <...

character encoding - Convert a text file from UTF-8 to ASCII to avoid python UnicodeEncodeError? -

i'm getting encoding error script, follows: from django.template import loader, context t = loader.get_template(filename) c = context({'menus': menus}) print t.render(c) file "../django_to_html.py", line 45, in <module> print t.render(c) unicodeencodeerror: 'ascii' codec can't encode character u'\u2019' in position 34935: ordinal not in range(128) i don't own script, don't have ability edit it. thing can change filename supplied doesn't contain unicode character script objecting. this file text file i'm editing in textmate. can identify , rid of character script barfing on? could use iconv, , if how? thanks! how find nasties in file: import unicodedata ucd import sys open(sys.argv[1]) f: linex, line in enumerate(f): uline = line.decode('utf-8') bad_line = false charx, char in enumerate(uline): if char <= u'\xff': continue ...

unicode - In MySQL how can I tell what character set a particular table is using? -

i have large mysql table think might using wrong character set. if i'll need change using alter table mytable convert character set utf8 but since large table, i'd rather not run command unless have to. question is, how can ask mysql character set on particular table? i can call status in mysql see database's character set, doesn't mean tables have same character set, right? try: show create table my_table;

java - Checking JAR Usage at the Package Level -

is there tool out there can check if imported jar being used within package? want remove unused jars project , not want have remove each jar one-by-one , check possible reference issues each removed jar. proguard trick you! configured correctly , given initial rules take jar files in input directory , output same jars output directory. java class files aren't needed won't included in output jars , if jar has no classes left, it's removed. website includes tons of examples . in addition doing this, has number of great features in compacting , obfuscating final project. configuration files may seem bit tricky @ first -- pays off. in projects @ work, have final archive sizes reduced on 1000%. how have included library use fraction of functionality? proper setup final product include what's needed.

android - How to disable background screen -

i have linearlayout set inside oncreate() method setcontentview(), creating popup @ runtime in same activity linearlayout b, popup placed bottom of screen/activity, want to disable background screen no touch/tap/click work. how can that. thanks this how it... recommend make root of layout relativelayout, put linearlayout inside that. linearlayout b should full size of screen , have 2 views inside (a top , bottom). bottom view popup using. top basic view has background color set black .25 (or .1) alpha on it's entirely see through. when want display popup (and disable interaction controls outside of popup), add linearlayout b relative layout attached top left (i.e. b should cover a). user able interact popup controls @ bottom , still able see linearlayout through transparent top portion of layout b, since grayed out user know aren't allowed interact it... , prevented interacting because overlay view block interaction.

Preventing a JavaScript event listener from firing multiple times concurrently (in a Google Chrome extension) -

i've set google chrome extension creates context-menu of user's bookmarks. contextmenus api must implemented through background page, added following event listeners update context-menu if there changes in user's bookmarks: chrome.bookmarks.onchildrenreordered.addlistener(function () { chrome.contextmenus.removeall(); contextmenu() }); chrome.bookmarks.onmoved.addlistener(function () { chrome.contextmenus.removeall(); contextmenu() }); chrome.bookmarks.oncreated.addlistener(function () { chrome.contextmenus.removeall(); contextmenu() }); chrome.bookmarks.onremoved.addlistener(function () { chrome.contextmenus.removeall(); contextmenu() }); chrome.bookmarks.onimportended.addlistener(function () { chrome.contextmenus.removeall(); contextmenu() }); it works, part, i've come across 1 bug cannot work out how kill. namely, if change multiple bookmarks concurrently (for example, selecting multiple items in bookmarks manager ,...

html - javascript event handling -

i building web form login. i've decided add in few features wouldn't normally. can't seem them work in every instance. so, here's problem. on form, progress through each of inputs javascript box on side of page scrolls down , notifies input i.e. can enter, how many characters have left. it works great text boxes, because can use onfocus , onblur event handler. when reach, example, div has multiple check-boxes can't use above event handlers each input, because have select option before box tells them about. ive tried using onmouseover , onmouseout event handlers whole div, doesn't work fluidly. so suggestions? maybe, there way active function if users puts cursor on part of screen? hope make sense, thanks could make little ? icon or next hover over, , attach event that... ...anyways...you sure doing right? post code...for example, works fine..when hover on 2nd checkbox, alert <form> <input type="checkbox" name="v...

iphone - Deleting/Removing Group in Xcode -

Image
i seem having odd problem iphone project in xcode4. by accident, seem have dragged new group created out of main project group: when try move group project group, xcode crashes. when try delete group dragging trash can, no such luck either. because it's iphone project, , somehow have messed entire directory of groups? i figured out. had empty group or folder whatever (let's call "stubborn group") @ same level project. wasn't able delete since option disable when right clicked on it. this how can remove "stubborn group" right click on project , select "new group selection" create new group named "new group" , put project in it now drag project outside of "new group" top (not inside) of "stubborn group" next highlight both groups , "delete"

postgresql - Design Relational Database - Use hierarchical datamodels or avoid them? -

i'm designing database , have doubts on using hierarchical datamodels in relational databases. if want deal categories, subcategories , parent categories possible not use hierarchical datamodels in relational database? words, possible deal categories, subcategories , parent categories using relational way of doing things? by way, i'm using postgresql. sorry bad english. best regards, you have couple of options store hierachies: adjacency list recursive query on adjancy list path enumeration nested sets closure table if have postgresql version 8.4 or later, can use recusive queries make things easy. far easiest solution, easy query, easy insert new records, easy update current records, easy delete records , have referential integrity. other solutions have parts hard solve. adjency list: create table categories ( id serial primary key, parent_id bigint, category text not null, foreign key (parent_id) references categories(id) ); i...

php - How do I count occurences of items in an array -

take array: array ( [#twitterwhites] => 0 [#lufc] => 0 [#football] => 0 [#liverpool] => 0 [#liverpool] => 0 [#espn] => 0 [#lufc] => 0 [#cafc] => 0 [#cafc] => 0 [#ocra] => 0 [#nra] => 0 [#2nd] => 0 [#secondamendment] => 0 [#scr] => 0 [#tc500] => 0 [#cpfc] => 0 [#mot] => 0 ) i want return result this: #liverpool = 2 #cafc = 2 #lufc = 1 etc etc how do it? you use array_count_values() function, bit of modifications array, counts values , , not keys . (as suggested in comment question, anyway, cannot have same key several times in array -- means array has items values, , not keys)

java - Richfaces, sortable datatable, sort icons -

is there way change sort icons of datatable? i know, possible set tag attribute sorticon rich:column replaces icon set @ generated <img> tag. there seems no way change align of img or size. you can redefine css class .rich-sort-icon . for example try playing float css attribute.

css - Div margin-bottom of a proportion of its own height? -

this question has answer here: how set margin or padding percentage of height of parent container? 6 answers for example, have div has height of 100px (i don't know height, let's suppose did). want set margin-bottom percent, 25% 25px assuming previous height. however, percent seems of document, not element: <div style="height:100px;margin-bottom:100%"></div> the margin should 100px isn't, 100% of height of page. the element line of text has no background, using height:150% theoretically work. as others note, don't know can use css this. jquery help: http://jsfiddle.net/userdude/pzavm/ <div id="margin">foo</div> div#margin { background-color:red; height:100px; } $(document).ready(function(){ alert($('#margin').height()); var margin = $('#margin').heig...

Calling constructors in c++ without new -

i've seen people create objects in c++ using thing mything("asdf"); instead of this: thing mything = thing("asdf"); this seems work (using gcc), @ least long there no templates involved. question now, first line correct , if should use it? both lines in fact correct subtly different things. the first line creates new object on stack calling constructor of format thing(const char*) . the second 1 bit more complex. following create object of type thing using constructor thing(const char*) create object of type thing using constructor thing(const thing&) call ~thing() on object created in step #1

class - jQuery - Multiple links and multiple classes. Toggle on/off -

i had 1 problem yesterday , both solutions here @ js section http://jsfiddle.net/6jm2s/22/ but have same problem ...except classes need removed different. this should explain want... http://jsfiddle.net/yewna/7/ any thoughts? solution demo: http://jsfiddle.net/yewna/16/ var klasses = $.map($(".links a"), function(elt) { return $(elt).attr("class"); }).join(" "); $(".links a").click(function(){ var link = $(this), abox = $(".abox"), klass = link.attr("class"); abox.hasclass(klass) ? abox.removeclass(klass) : abox.removeclass(klasses).addclass(klass); return false; }) try (updated)

jquery toggle did not work properly -

function advanced_search() { $("#advanced_link").toggle( function(){ $('#advanced_link').text('hide - advanced search'); $('.advanced_search').show(); }, function(){ $('#advanced_link').text('show - advanced search'); $('.advanced_search').hide(); }); } this code worked me..but when tried use css property like function advanced_search() { $("#advanced_link").toggle( function(){ $('#advanced_link').text('hide - advanced search'); $('.advanced_search').css('display','inline'); }, function(){ $('#advanced_link').text('show - advanced search'); $('.advanced_search').css('display','none'); }); } it did not work...is there thing wrong in second code...?? shot in dark instead of inline, use block $('.advanced_search').css('display','block');

WPF - Listview with button -

i have listview template , 1 column button. need selected item when click in button. how can ?? to cature selected listview item inside button pressed event can leverage mvvm pattern. in listview, in xaml, bind itemssource , selecteditem viewmodel class. bind button command in template runcommand in viewmodel. the tricky part getting binding correct template active datacontext. once can capture selectedcustomer inside runcommand gets executed when button gets pressed. i've included of code started. can find implementations of viewmodelbase , delegatecommand via google. here xaml: <window x:class="listviewscrollposition.views.mainview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="main window" height="400" width="400"> <grid> <listview itemssource="{binding path=customers}" ...

bash - shell script working fine on one server but not on another -

the following script working fine on 1 server on other gives error #!/bin/bash processline(){ line="$@" # complete first line complete script path name_of_file=$(basename "$line" ".php") # seperate path name of file excluding extension ps aux | grep -v grep | grep -q "$line" || ( nohup php -f "$line" > /var/log/iphorex/$name_of_file.log & ) } file="" if [ "$1" == "" ]; file="/var/www/iphorex/live/infi_script.txt" else file="$1" # make sure file exist , readable if [ ! -f $file ]; echo "$file : not exists. script terminate now." exit 1 elif [ ! -r $file ]; echo "$file: can not read. script terminate now." exit 2 fi fi # read $file using file descriptors # $ifs shell variable. varies version version. known internal file seperator. # set loop separator end of line backupifs=$ifs #use temp. variable such $ifs can res...

asp.net - how to access a file from target URL after an XMLHttpRequest post -

i trying upload , save image file server using xmlhttprequest post after allowing file selection done on client's side using html5 , java script (using html input element). my problem cannot find out how hold of file server side , save server. this code: xhr = new xmlhttprequest(); // update progress bar etc xhr.upload.addeventlistener("progress", function(evt) { if (evt.lengthcomputable) { progressbar.style.width = (evt.loaded / evt.total) * 100 + "%"; } else { // no data calculate on } }, false); // file uploaded xhr.addeventlistener("load", function() { progressbarcontainer.classname += " uploaded"; progressbar.innerhtml = "uploaded!"; }, false); xhr.open("post", "imagesave.aspx", true); // set appropriate headers ...

c++ - Speeding up a function with dynamic programming -

i have program //h our n static int g=0; int fun(int h){ if(h<=0){ g++; return g; } return g+fun(h-1)+fun(h-4); } is possible speed using dynamic programming? i figured out function runs in o(2^n) i supposed reduce running time dynamic programming, not understand concept. just asking nudge in right direction. while can't give answer actual question, intrigued altogether different, namely statement return g+fun(h-1)+fun(n-4); obviously, function has side effect of changing global static variable g . not 100% sure whether return statement's expression evaluates in defined fashion, or whether result might undefined. it might nice exercise think order in function calls executed, , how affects g , thereby function's result.

c# - WPF: Order of stretch sizing -

i'm creating modal dialog window contains 3 essential parts: textblock containing instructions, contentcontrol dialog panel, , contentcontrol dialog buttons. each of these parts contained in separate grid row. i have specific constraints when comes how dialog should sized. issue i'm having instructions textblock. want instructions wide contentcontrol dialog panel. instructions should wrap , grow vertically needed. should instructions not able grow vertically, should begin grow horizontally. getting instructions width of contentcontrol , grow vertically simple. part can't seem figure out how grow horizontally when out of vertical space. initial thought create class extends textblock , override measureoverride. however, method sealed. currently, i'm playing idea of have dialog window override measureoverride calculate available size instructions block. am missing simpler way of accomplishing this? have better ideas this? messing measureoverride seems lot of work...

android - change background of an ImageView (the old image stays there!) -

how can change background of imageview java? have imageview , @ point need change image displays (set in styles). tried this: placeholder.setimagedrawable(mydrawb); but looks old image remains there , partially covered new 1 (which in case has different shape). hope guys can help! cheers you don't need touch xml use src instead of background! an imageview can display 2 drawables! 1 in background , other in foreground. seems changing background image. instead of setbackgroundresource(resid) use setimageresource(resid) change foreground image!

repository - Rollback multiple commits (before Pushed to public) in Mercurial -

i aware rollbacks can remove commits latest changeset in local repository. however, possible remove latest commits since previous push without having re-clone share repository? you make new repo hg clone : hg clone -r last_good_changeset localrepo newlocalrepo

generics - Suppressing Java unchecked warnings in JSP files -

i have legacy webapp uses jstl , struts 1 tags. when pre-compile jsp files java 5/6, jstl , struts 1 tags throw warnings "unchecked or unsafe operations". example, if use following tag: <%@ page import="/anotherpage.inc" %> the following warning thrown: [javac] note: input files use unchecked or unsafe operations. [javac] note: recompile -xlint:unchecked details. if recompile -xlint:unchecked, details internal working of offending jsp tag library. suppress unchecked operation warnings. thought using -xlint:-unchecked suppress warnings, did not. how suppress these warnings when compiling jsp pages? not practical re-code jsp tag libraries or update thousand jsp pages. i'm looking compiler flag globally disable warning can see warnings except unchecked warnings. thanks! those messages (mandatory jdk >= 1.5) note, not warning. compiler.note.unchecked.plural=\ input files use unchecked or unsafe operations. the default compi...

jquery - Add validation image for success/fail -

i using jquery tools validator , add simple green checkmark img (http://p.yusukekamiyamane.com/) once of fields pass validation and, onsubmit add simple cross img , red border ones fail validation. right now, have red border along standard error message. can't figure out how remove error message , replace green check or red cross img: http://jsfiddle.net/rd44z/ i think need use onsuccess can't seem figure out how put in/toggle images. great. you can use success option , set class on label decorate image. .validate({ success: function(label) { label.addclass('valid'); } });

Rails - is there a way to get Rails to render a Style .css file inside of the view? -

instead of page making request css, have rails view render css file in page, it's 1 request. is possible? altough typical way include css using stylesheet_link_tag (in particular gets cached client), possible put directly in <head> in rails 3.1: <head> .... <style type="text/css"> <%= youappname::application.assets["your_stylesheet.css"].to_s.html_safe %> </style> </head> i adapted this post .

python - Sharing data between two lists -

first let me thought way data storage worked in python object there no need such things pointers. if pass piece of data function function has real piece of data. when exit out of function data passed in have been modified. now working lists , thought if put same piece of data on 2 lists modifying in 1 place modify in other. how can have 1 piece of data on two, or more, different lists? want change data in 1 place , have other change. for example take following: p = 9 d = [] f = [] d.append(p) f.append(p) print 'd',d print 'f',f p = 3 print 'd',d print 'f',f when run output is: d [9] f [9] d [9] f [9] i second set of data 3 doesn't seem work. in thought process did go wrong? there implicit copy operation when putting data onto list? first of all, integers (really, number objects) immutable. there no "modifying" "data". second of all, there in python notion of name binding . when do: p = 9 tw...

sql - Get the aggregate column values in JSP when using group-by -

i have problem when retrieving data sql using jsp. resultset rs = statement.executequery("select orderdate, sum(orderingcost) `shopping`.`order` group orderdate"); int count = 0; //string while (rs.next()) { //string orderdate = rs.getstring("orderdate"); //string orderingcost = rs.getstring("orderingcost"); system.out.println(count); count++; } i use group statement group data. however, don't know how data out when group applied. can me? you need alias column: select orderdate, sum(orderingcost) orderingcost `shopping`.`order` group orderdate then you'll have column named orderingcost in resultset, , can do: double orderingcost = rs.getfloat("orderingcost") // need getfloat instead of string since it's numeric value

asp.net - Adding an internal ASPX page with relative URL to CRM 4.0 sitemap -

i've added subarea sitemap in crm 4.0, , absolute urls works expected. however, relative urls not. page in question internal , accessed through: http://localhost/isv/<orgname>/account.aspx/externaldocumentlist however, prefer writing in sitemap: /isv/<orgname>/account.aspx/externaldocumentlist when expanded, crm/iis rewrites to: http://localhost/<orgname>/isv/<orgname>/account.aspx/externaldocumentlist for reference, here sitemap addition (which doesn't work): <subarea id="custom_documenthistory" url="/isv/<orgname>/account.aspx/externaldocumentlist"> <titles> <title lcid="1033" title="document history"/> </titles> </subarea> how can link page relatively? the ../ notation valid signifying operation. there isn't problem using notation, though depends on usage. the first instance of <orgname> in url default behaviour of crm...

javascript - Why can't jQuery UI sortable elements be dragged from a handle? -

i have page add fields fake form user can @ before generating source. i'm trying give user ability sort , order fields inside form. use jquery ajax , animations, decided use jquery ui sorting. my fields added dinamicly, delegate events, , use sortable('refresh'); every time new field added. my gui has icons fields options, added handle option sortable() method, doesn't recognize @ all! here demo of gui problem (it's in arabic , still in alpha no ie7-6 support, uses icons easy use ^^): http://mahersalam.co.cc/projects/namodgmaker/ just add field red buttons, , try drag drag button, doesn't work. if remove handle works perfectly! you can see log handle value console, logs sortable object... there global object namodgmaker want experiment it. here part adds fields , attach sortable() method: addfield: function( type ) { var $html = $(this.fields[type]); // 'this' here namodgmaker, , `fields` ajax request if (type == ...

osx - Determine if file location is an alias in bash scripting -

symlinks different aliases, although seem serve same purpose (more or less/i think). need able tell if file alias, , if [ -h /path/to/file ] doesn't work. there aliases? google unhelpful aliases apparently name else in bash altogether. thanks! the finder stores information file alias in resourcefork of file. read metadata, use spotlight determine kind of file; following command return kind of file, compare in if-statement. mdls -raw -name kmditemkind /path/to/test.pdf returns pdf (portable document format) mdls -raw -name kmditemkind /path/to/test.pdf\ alias returns alias an other way incorporate applescript, executable on command line via osascript. return kind of file, run: tell application "finder" kind of ((posix file "/path/to/test.pdf\ alias") alias)

c# - how to insert a jpeg image into an excel sheet -

i'm able generate tables required columns , data excel sheet. want insert image present in bin. how achieve this? look here: c# excel image paste image through clipboard.

Can I translate my website with Google Translate? -

i have web page created in english. depending on continent, want dynamically translate whole webpage language. the webpage complex, cannot string string. want in way @ time of loading translated desired language. can translate webpage using google translate api? here example to add google translator web page translate specific element: <html> <head> <title>my page</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> </head> <body> <div class="translate">Тестирование</p> <div class="translate_control" lang="en"></div> <script> function googlesectionalelementinit() { new google.translate.sectionalelement({ sectionalnodeclassname: 'translate', controlnodeclassname: 'translate_control', background: '#f4fa58' }, 'google_sectional_el...

Grails Invoke a controller method from a scheduled job -

in grails application i'd invoke scheduled job class method contained in controller. reading [http://www.grails.org/job+scheduling+(quartz)], can see datasources , services auto-wired name in job classes. seems not possible controllers default, 'cause controllers aren't supposed kind of stuff. btw, there way controller method called job in grails? , such bad practice (and why)? thanks in advance, luca it's bad practice because controller intended handle web requests - user session , everything. there no user session in quartz job. second, keeping functionality in controller bad thing on own - controller should better "control" invocations other business logic method. i'd recommend move functionality either service, domain class or pogo class in src . of course, can call new mycontroller().method() , no beans injected controller default.

java - What is the difference between an OutOfMemoryError amd a memory leak -

iam working on java application,whose architecture java-ee component one-end , c++ component on end. when executing app continiously got java.lang.outofmemory error in java heap.when discussed told 1 different java memory leak.if difference between outofmemory error , java memory leak.and how can analyse both things java profilers available in market.could please clarify.. thanks in advance, raghavamoorthy.k a memory leak in java when objects aren't using cannot garbage collected because still have reference them somewhere. an outofmemoryerror thrown when there no memory left allocate new objects. caused memory leak, can happen if you're trying hold data in memory @ once. the jdk includes useful tools jhat , visualvm allow inspect objects in memory , references between them. using these can find objects causing problem. example here particularly stupid memory leak. old objects never used, cannot garbage collected. while may seem ridiculous, can create e...

php - Trying to Automate/Loop a Save Function -

edit: difference between pages $q1, $q2, $q3 becomes, example, $q13, $q14, $q15 - questions in form. hi all, i have following code: $rguid = $_post["r"]; $ip=substr($_server['remote_addr'], 0, 50); $browser=substr($_server['http_user_agent'], 0, 255); $q1 = $_post["q1"]; $q2 = $_post["q2"]; $q3 = $_post["q3"]; $q4 = $_post["q4"]; $q5 = $_post["q5"]; $q6 = $_post["q6"]; $q7 = $_post["q7"]; $q8 = $_post["q8"]; $respondent_id = decode_respondent_guid($rguid); $rcount=respondent_status($respondent_id); if ($rcount==0) { $proc = mysqli_prepare($link, "insert tresults (respondent_id, ip, browser, q1, q2, q3, q4, q5, q6, q7, q8) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"); mysqli_stmt_bind_param($proc, "issiiiiiiii", $respondent_id, $ip, $browser, $q1, $q2, $q3, $q4, $q5, $q6, $q7, $q8); mysqli_stmt_execute($proc); $mysql_error = mysqli...

vba - Excel Density Map -

i trying create density map in excel. map in seperate worksheet data stored. problem having right being able access data in separate worksheet 1 vba function running in. thought this: dim row range ' loop through rows 4 -> 550 x = 4 550 set row = worksheet(1).range(cells(x, 1), cells(x, 24)) ' range of cells further processing next counter the problem when run code test getting excel returns follow error "worksheet(1)": compile error: sub or function not defined all data stored in worksheet #1 , density map being created in worksheet #6. how can go doing this you should consider using this set row = worksheets(1).cells(x,1).resize(1,24) the range reference qualified worksheets(1) point range on worksheet. cells references unqualified , point range on activesheet, may not want.

Why can't I get Eclipse / EPIC to display line numbers? -

i installed epic, cannot see line number enable line number, idea? this worked me: goto: window->preferences->perl epic->editor, place check beside "show line numbers." window->preferences->general->editors->test editors, uncheck show line numbers. click apply. if line numbers not show up, right click on left margin of perl file viewing , click "show line numbers" popup menu. make sure uncheck 1 in general settings , check 1 epic settings. you may need restart eclipse see line numbers.

actionscript 3 - Can Flash AS3 FileReference access the size of a file on local disk before uploading to PHP? -

i want able size of file before uploading php script using filereference. can file size before detecting bytestotal during upload process? you should able access through "size" property of filereference object. http://www.adobe.com/livedocs/flash/9.0/actionscriptlangrefv3/flash/net/filereference.html#size

jvm - Java and UseLargePages -

we have number large heap (6-12gb, larger) jvm servers. i'm considering configuring linux large page support. usual ymmv, of have availed yourselves of capability, how difference did make situation? how important choice of page size specified in largepagesizeinbytes? thanks, david i have collected number of resources large pages, java , other environments / applications / oses / hardware (mysql, linux, sparc, amd). people significant increases in performance. http://zzzoot.blogspot.com/2009/02/java-mysql-increased-performance-with.html [note last updated page 2010/07]

MySQL query question -

i have mysql table contains many rows. table structure follows: id: bigint, event_type: int, total: int sample data: id event_type total 1 1 null 2 -1 null 3 1 null 4 1 null 5 1 null 6 -1 null 7 -1 null 8 -1 null the event_type either 1 or -1 . total set null . there simple sql query accumulate values of event_type in total . so, table like: id event_type total 1 1 1 2 -1 0 3 1 1 4 1 2 5 1 3 6 -1 2 7 -1 1 8 -1 0 also, total column can partially calculated. in other words, need run query while table still being modified (by insertions). know can done using php or perl code. however, nice using sql queries. since indeed mysql not allow update table reading from, can temporary table. create table temp s...

xml - SQL Server XQuery: How to avoid "illegal qualified name character" exception? -

i'm working on xquery may/can contain characters ">", "<" , single quotes. how avoid breaking xml parser? my xml form this <root> <container> <item>(d.field <> 0)</item> </container> </root> the "xml" you've shown isn't xml. either of following xml: <root> <container> <item>(d.field &lt;&gt; 0)</item> </container> </root> or: <root> <container> <item><![cdata[(d.field <> 0)]]></item> </container> </root>

Where should I add Java files in web (WAR) project in Maven? -

where should have java source folder in maven web application architecture results in war? suggestions needed. the basic structure standard maven project following. src/main/java application/library sources src/main/resources application/library resource src/main/filters resource filter files src/main/assembly assembly descriptors src/main/config configuration files src/main/webapp web application sources src/test/java test sources src/test/resources test resources src/test/filters test resource filter files src/site site following maven recommendations , normal behavior makes easier other people familiar maven easy recognize , understand structure. source/read more

visual studio 2010 - C++: Switching from MSVC to G++: Global Variables -

i switched linux , wanted compile visual studio 2010 c++ source code, uses stl, on g++. my linux machine isn't available can try tell going on, first: as try compile project, global variables use in main , work on msvc result in myglobalvar not defined in scope errors. my project built same example below: // myclass.h class myclass { // .... }; extern myclass globalinstance; // myclass.cpp #include "myclass.h" // myclass functions located here myclass globalinstance; // main.cpp #include "myclass.h" int main( ) { // accessing globalinstance results in error: not defined in scope } what doing wrong? where differences between g++ , msvc in terms of global variables? you need compile follow: g++ main.cpp myclass.cpp -o myapp not follow: g++ main.cpp -o myapp miss global variable declaration in myclass.cpp file.

layout - Android Problems Converting ViewGroup with Children into Bitmap -

i'm converting viewgroup (relativelayout) bitmap using canvas. however, when draw happens see viewgroup background drawable , not children (two textviews) should laid out within relativelayout using rules fill_parent. the relativelayout created using following static function: public static relativelayout createprogrammeview(context context, int width, int height, string title, string time) { relativelayout.layoutparams params; // layout root view (relativelayout) relativelayout rlv = new relativelayout(context); params = new relativelayout.layoutparams(width, height); rlv.setlayoutparams(params); rlv.setpadding(3, 3, 3, 3); rlv.setbackgroundresource(r.drawable.background); // layout title textview tv = new textview(context); params = new relativelayout.layoutparams(relativelayout.layoutparams.fill_parent, relativelayout.layoutparams.wrap_content); params.addrule(relativelayout.align_parent_top); params.addrule(relativelayou...

django - Pinax : Out of the blue : "no such table: profiles_profile" -

note : pinax 0.7.3 i'm running clone of basic_project sqlite3. it working fine yest. hibernated laptop , when opened , try login again, got - no such table: profiles_profile opened database dev.db using sqlite3 client , don't see there. stopped server, deleted db, did syncdb created new dev.db , missing table. looking views.py of profiles app, i'm sure didn't dodo in it. the settings.py has basic_profiles installed apps. the exception shows query fired - 'select "profiles_profile"."id", "profiles_profile"."user_id", "profiles_profile"."name", "profiles_profile"."about", "profiles_profile"."location", "profiles_profile"."website" "profiles_profile" "profiles_profile"."user_id" = ? ' that table structure same of basic_profiles , can't figure could've mistyped while viewing t...

In SQL Server, is TOP deterministic by default when used on a table with a clustered index? -

so trying explain people why query bad idea: select z.reportdate, z.zipcode, sum(z.sales) sales, coalesce( (select top (1) groupname dbo.zipgroups (zipcode = z.zipcode)), 'unknown') groupname, coalesce( (select top (1) groupcode dbo.zipgroups (zipcode = z.zipcode)), 0) groupnumber dbo.report_byzipcode z group z.reportdate, z.zipcode and suggesting better way write it, when boss ended discussion with, "well, it's been returning right data last year , haven't had problems it, it's fine." at point thought myself, how in world possible? after digging, discovered these facts: this query supposed group sales zipcode , date, , link largest group (by population size) zipcode assigned way of zipgroups table. each zipcode can assigned 0 many groups, , if zipcode assigned 0 groups, it's not in zipgroups table. a group geographical area, , groupnumbers ranked largest smallest population (for example, group covering ny-nj-ct tri-state a...

jQuery validation plugin , add custom method -

i trying add method validate field see if contains number value. so did, not doing check me. has idea? thanks $(document).ready(function() { $.validator.addmethod('positivenumber', function(value) { return number(value) > 0; }, 'enter positive number.'); }); and jquery('form').validate(); jquery('.validatefieldtocheck').rules('add', { positivenumber:, messages: { required: 'field must contain number.' } }); afaik, should try, instead of second block of code have, following: $('#your-form-id').validate({ rules: { yourformfieldidtocheck: { required: true, positivenumber:true } }, messages: { yourformfieldidtocheck: { required: "this value requi...

Rails - Updating a record? -

This summary is not available. Please click here to view the post.

open,edit and save xml file with schema using php -

hy... i'm new in xml schema, xsl,... (i have basic understanding) on web page: http://w3schools.com/xsl/xsl_editxml.asp shown example open,edit,save xml file, asp. know how can open/edit , save xml file using php next example: <?xml version="1.0" encoding="iso-8859-1"?> <tools> <tool id="1"> <field id="prodname"> <value>hammer hg2606</value> </field> <field id="prodno"> <value>32456240</value> </field> <field id="price"> <value>$30.00</value> </field> </tool> <tool id="2"> <field id="prodname"> <value>audi</value> </field> <field id="prodno"> <value>88885</value> </field> <field id="price"> <value>$26.00</value> </field> </tool> </tools> and ...

c# - VB.NET, make a function with return type generic? -

currently have written function deserialize xml seen below. how change don't have replace type every time want serialize object type ? current object type ctoolconfig. how make function generic ? public shared function deserializefromxml(byref strfilenameandpath string) xmlhandler.xmlserialization.ctoolconfig dim deserializer new system.xml.serialization.xmlserializer(gettype(ctoolconfig)) dim srencodingreader io.streamreader = new io.streamreader(strfilenameandpath, system.text.encoding.utf8) dim thisfacility ctoolconfig thisfacility = directcast(deserializer.deserialize(srencodingreader), ctoolconfig) srencodingreader.close() srencodingreader.dispose() return thisfacility end function public shared function deserializefromxml1(byref strfilenameandpath string) system.collections.generic.list(of xmlhandler.xmlserialization.ctoolconfig) dim deserializer new system.xml.serialization.xmlserializer...

Overloading ostream -

i have class example test in test.h have friend ostream& operator<< (ostream& out, const test& outstr); in test.cc ostream& operator <<(ostream& out, test& strout) { out<< "test"; return out; } in main test x; cout<< x; i recieve error message: error: undefined reference `operator<<(std::basic_ostream >&, test const&) whats problem? you have const in declaration: friend ostream& operator<< (ostream& out, const test& outstr); and no const in implementation: ostream& operator <<(ostream& out, missing const test& strout) adding const implementation should solve issue.

php - Why mysql is not storing data after "#" character? -

i have made 1 form in there rich text editor. , m trying store data database. have 2 problem.. 1) string contents "#"(basically when try change color of font)     character, not store characters after "#". , not store "#" character also. 2) although had tried....in javascript html.replace("\"","'"); but not replace double quotes single quotes. we'll need see code. feeling you're missing essential escaping step somewhere. in particular: as string contents "#"(basically when try change color of font) character implies me might sticking strings url this: var url= '/something.php?content='+html; naturally if html contains # symbol, you've got problems, because in: http://www.example.com/something.php?content=<div style="color:#123456"> the # begins fragment identifier called #123456"> , when put #section on end of url go anchor called ...

c# - Radiobutton checked change event not firing in gridview -

i have gridview have radio button. need on selection of radiobutton have find datakey of gridview. 1 more issue , can select more 1 radio button, should not happen. you need use literal control inject radio button markup. handle grouping 1 radio button selected. cannot standard radio control group. see complete example working code: http://www.asp.net/data-access/tutorials/adding-a-gridview-column-of-radio-buttons-vb

javascript - Jquery Change event for input and select elements -

i trying alert when ever drop down box changes , when ever typed input. don't think can use change input fields? use input fields? also, input fields of type file? same thing. here have far , not working: $('input#wrapper, select#wrapper').change(function(){ alert('you changed.'); }); thanks all you can bind keypress event text box. $("#wrappertext").bind("keypress", function(){ // code }); in sample have used same id text box , select box. change also.

.net - WCF Throttling and Connection Limits -

i have browsed internet , stack overflow answers can't seem clear answer issues. i have around 50 clients spread out across country regularly open wcf wshttpbinding call automatically through windows service server every 10-20 mins. works because limit # of clients can connect , perform long running operations through server , client knows cannot , tries next time checks in. this has been working until yesterday when 1 client has 7 separate systems behind same router started having very slow internet issues. 7 systems open connection server every 10-20 mins, , perform "check-in" procedures. calls take while , each system may connected service @ once using 7 connections server. other 43 systems need "check-in" every 10-20 minutes. since client 7 systems having slow internet, calls long running processes on serice taking longer normal , timing out on client (i got stale security timestamp errors sometimes). in return hang wcf service responding other...

javascript - Backbone.js cause bug only in IE7 -

i'm developping web app codeigniter on back-end , backbone.js on front-end. i'm using html5 boilerplate start template. i'm using backbone's controller , history main navigation through application. i've done 1 time in past , have work fine. problem is, when start hashchange event capture backbone.history.start() , click on link example.com/#home, hash change in url, event fired 2 seconds after, hash cleared url , javascript error throw in ie7. i've take @ source code , hashchange event acheived in ie7 creating iframe running interval check hash value change. anyone had weird bug before , know how solve this? the right way handle #hash base application backbone seems backbone.history.savelocation( hash ) , after backbone.history.loadurl() enable controller's routing. whish knew before... have fun awesome mvc library :)

ASP.NET Nested masterpages, how to set content in the top page from the aspx file? -

i have content cms need move raw asp.net pages. since templates nested guess can use nested masterpages acomplish it, i'm finding can't set values on top masterpage deep child page. here sample. have several nested masterpages contentplaceholders: top master (with contentplaceholder1) nested master, dependent on top master (with contentplaceholder2) aspx page, dependent on nested master, defines content contentplaceholder1 , 2 the problem asp.net doesn't allow me have value of contentplaceholder1 defined in content page, should defined in nested master. point client page knows value, not template masters (for instance, page knows graphic has display on the top, placeholder graphic top master). how can set values in aspx page rendered in top master? normally have following: setup public property on master page add @masterpage declaration top of content page want access property in access property master.yourpageproperty = "value"; i...

c# - Determining CPU and RAM usage in a Silverlight 4 WIndows Sidebar Gadget -

i'm trying write silverlight 4 windows sidebar gadget that, among other things, can monitor usage of each cpu core (as percentage) , usage of ram (in bytes) of host computer. i've tried using system.management, visual studio won't let me add it, it's not part of silverlight. in end, i'm looking method returns usage of specific cpu core. automatically detecting number of cores bonus. same goes ram. extensive searching has led me believe possible through com+ automation, i'm clueless how. direction appreciated. you can use system.windows.analytics class systems stats.. it has averageprocessorload can use current cpu usage(value between 0 , 1) .and silverlight only. you can use this: float averagecpuusage = system.windows.analytics.averageprocessorload; float myappcpuusage = system.windows.analytics.averageprocessload;// cpu usage current app. update but silverlight far can go.. ram , processor count need have somthing installed o...

Debugging migrations in rails 3 using ruby-debug? -

how debug migrations using ruby-debug in rails 3? running rake db:migrate not seem trigger debugger command in rails 2. , rake db:migrate --debugger not work either. thanks. i able debug migration doing following add ruby-debug gemfile gem 'ruby-debug19' in migration add require 'ruby-debug' , execute debugger in line want stop. example require 'ruby-debug' class createpeople < activerecord::migration def self.up debugger create_table :people |t| t.string :name t.string :email t.timestamps end end def self.down drop_table :people end end then run rake db:migrate or other db command. example ~/dev/ruby/migrate$ rake db:migrate (in /users/augusto/dev/ruby/migrate) == createpeople: migrating =================================================== /users/augusto/dev/ruby/migrate/db/migrate/20110212134536_create_people.rb:7 create_table :people |t| (rdb:1) list [2, 11] in /users/augusto/dev...

iphone - Getting the contents of a text field as a number -

i have textfield in app, whre user can enter number (i have set number pad) want store integer in variable writing int numofyears = [numofyearsfld text]; but reason taking incorrectly e.g. if user enters 10, taakes 10214475 am doing wrong ? intvalue returns int . integervalue returns nsinteger . nsinteger numofyears = [[numofyearsfld text] integervalue];

php - Sending secure wse headers via Soap in php5 -

i having problem sending security wse headers consume web services , tried several dozens way of using webservice targetprocess.com , not sure doing wrong. (http://demo.tpondemand.com/services/projectservice.asmx?wsdl) their example uses old version of nusoap, trying using php5 built in soapclient class. i stuck between receiving bad request errors or unable authenticate. how can send these headers? this have far doesn't work: $tp_header_part = ' <wsa:action> http://targetprocess.com/retrieveall </wsa:action> <wsa:messageid> urn:uuid:'.$this->getguid().' </wsa:messageid> <wsa:replyto> <wsa:address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:address> </wsa:replyto> <wsa:to>http://medios.tpondemand.com/services/projectservice.asmx</wsa:to> <wsse:security soap-env:mustunderstand="1"...

android - Get home wallpaper and set it to my activity -

i want home wallpaper set , put background activity. possible ? i searched on internet wallpaperinfo v = w.getwallpaperinfo(); string name = v.getservicename(); i have service name (because wallpaper live service) example, have com.android.wallpaper.grass.grasswallpaper ...can use start service activity? if so, how? try add attribute tag in manifest: android:theme="@android:style/theme.wallpaper"

file io - Writing 'getSelectedFile' as a String (Java) -

open.addactionlistener(new actionlistener(){ public void actionperformed (actionevent e){ jfilechooser filechooser = new jfilechooser(); filechooser.setcurrentdirectory(new java.io.file(".")); filechooser.setfileselectionmode(jfilechooser.directories_only); if (filechooser.showopendialog(null) == jfilechooser.approve_option){ system.out.println(filechooser.getselectedfile()); } } }); this might badly worded question here go: i need part of code produce 'filechooser.getselectedfile());' in format can used elsewhere. don't mind if variable (won't work because need call in actionlistener) or (as planned) output selected folder string output file , read file in elsewhere in program. it's important file path (e.g. c:/users/desktop/) string because class use path takes in. i've tried couple of options "inconvertable types' compile er...

join - Using MySQL to generate daily sales reports with filled gaps, grouped by currency -

i'm trying create think relatively basic report online store, using mysql 5.1.45 the store can receive payment in multiple currencies. have created sample tables data , trying generate straightforward tabular result set grouped date , currency can graph these figures. i want see each currency available per date, 0 in result if there no sales in currency day. if can work want same grouped product id. in sample data have provided there 3 currencies , 2 product ids, in practice there can number of each. i can correctly group date, when add grouping currency query not return want. i based work off this article . my reporting query, grouped date: select calendar.datefield date, ifnull(sum(orders.order_value),0) total_value orders right join calendar on (date(orders.order_date) = calendar.datefield) (calendar.datefield between (select min(date(order_date)) orders) , (select max(date(order_date)) orders)) group date now grouped date , currency: select calendar....