Posts

Showing posts from April, 2010

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

bash - executing scripts on Google App Engine localhost -

is there easy way execute scripts on google app engine localhost? instance have few scripts generate pilot data, it's quite painful copy-and-paste them interactive console time. currently, i'm using simple bash script this, i'm not sure best solution. curl --data-urlencode "code=`cat src/gen_pilot_data.py`" http://localhost:8079/_ah/admin/interactive/execute thanks, v check out remote_api_shell.py, included in sdk. lets run code on local machine against apis on app engine app, in production or on dev_appserver. the other option have make scripts handlers, , or post relevant urls.

simultaneous - Can i increase my weblogic 8 license for more than 3 user -

i using weblogic 8 in project. deployed folder accessed 3 user simultaneously. fourth user unable access url. , getting 403 error. error is: the server not licensed operation. what solution this?? what solution this?? pay more money.

android - ListView color issue -

Image
hey i'm not professional coder stretch, i've been playing around simple to-do list learn basics of android development. i've been able want working, there 1 problem listview has me totally stumped. i've extended simplecursoradapter in order format data coming sqlite database , change color of duedate text based on whether or not duedate has expired. formatting works flawlessly, i'm getting odd results colors. the first few entries in listview expect them to, scroll down, inconsistencies start popping items no due date set colored red or green. more scroll , down in list, more inconsistencies appear until every row colored whether should or not. can me understand going on here? please see custom adapter below. public class proadapter2 extends simplecursoradapter { private static int[] = {r.id.priority, r.id.projectname, r.id.duedate}; private static string[] = {"priorities", "projectname", "duedate"}; private cont

nservicebus - Impossible to have two sagas that handle the same message type -

i have 2 different sagas (i mean saga types) handle same message. public class attachmessagetobugsaga : tpsaga<attachmessagetobugsagadata>, iamstartedbymessages<messageisnotattached>, ihandlemessages<messageattachedtogeneralmessage> { public override void configurehowtofindsaga() { configuremapping<messageattachedtogeneralmessage>( saga => saga.id, message => message.sagaid ); } public void handle(messageisnotattachedtobug message) { send(new attachmessagetogeneralcommand { messageid = 66, generalid = 13 }); } public void handle(messageattachedtogeneralmessage message) { //do stuf fhere } } public class attachmessagetobugsagadata : icontainsagadata { public guid id { get; set; } public string originator { get; set; } public string originalmessageid { get; set;

css - Website doesn't find stylesheet in Safari/IE -

Image
no idea why happening... looks in firefox: and looks in safari: a quick inspection firebug safari shows not picking style sheets except transmenu.css (for menu - isnt' being used). can't find reason why happen. any ideas? website: http://tradartsteam.co.uk thanks @thomas clayson: remove </script> on ln. 35 of source-code. edit : it's 2 lines after <script type="text/javascript" src="/_common/js/mootools-1.2-more.js"></script> update : @thomas clayson: way page display fine comment out entire <script> element $.noconflict(); inside until before <script language="javascript" type="text/javascript" src="/js/swfobject.js"></script> . $.noconflict(); on own breaks page again. i'll more digging , update answer again (unless else can find solution before me). super massive update : @thomas clayson: after going little batty couldn't see/find problem, se

c# - saving and retrieving values from session state in asp.net -

i reviewing web code , not sure how asp.net session state works. helps gratefully appreciated. if user object saved session state during login, , user.firstname , user.lastname set. if other web pages retrieve user object session , set firstname else persisted on other web pages? or, need re-add user object session once has been modified? thanks session persisted on server, tracked via client. repeat - via client. in cases, sessions tracked cookies. using example, when user object saved session: session["userinfo"] = new user { firstname = "joe", lastname = "bloggs" }; a cookie sent client unique identifier. cookie passed along further http requests client/browser unless expires. if user comes along (from different machine) first time, session["userinfo"] null. an alternative cookies "cookieless-session" - instead of using cookie store session identifer - identifier tacked onto url. so answer no - other web

export a php file to excel -

how can set style table while export php file excel using following code can export php file excel header("content-disposition: attachment; filename=".$fname."application.xls"); print "<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\"> <style> @page {margin:1.0in .75in 1.0in .75in; mso-header-margin:.5in; mso-footer-margin:.5in;} tr {mso-height-source:auto;} col {mso-width-source:auto;} br {mso-data-placement:same-cell; } .style0 {mso-number-format:general; text-align:general; vertical-align:bottom; white-space:nowrap; mso-rotate:0; mso-background-source:auto; mso-pattern:auto; color:windowtext; font-size:10.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:arial; mso-generic-font-family:auto; mso-font-charset:0; border:none; mso-protection:locked visible; mso-style-name:normal; mso-style-id:0;

php - What is double plus in regular expressions? -

i have been seeing in php script: [a-za-z0-9_]++ what double plus mean? that's possessive quantifier . it means if regex engine fails matching later, not go , try undo matches made here. in cases, allows engine fail faster , , can give control need - rare uses.

Operator overloading in c (not c++) is it possible? -

this question arises need "convert" std::string char* form. preferably maintain code possible , includes plenty of "=" initialization/assignment operators. standard c operators exist basic data types (int, char, float, pointers to, etc...). is possible overload assignment operator in c? suppose each data type it's own operator messing 1 wouldn't mess others. anyhow, intrigued me can't find references on how c operators implemented. cheers well, examples in order std::string a_string; a_string = "bla" or using standard c char a_char_array[10]; strcpy(a_char_array,"bla"); or char *a_char_pointer = "bla"; what i'm thinking wa replace these 3 use cases single 1 can (through #define) switch between using char* or std::string. i guess cares performance vs coding speed has thought implications of using std::string instead of char*. of advantages of using stl offseted (is word!?) lower performance (

windows - How to create catalog in indexing service using c# -

i want automate windows indexing service. this has done in c#. concept :- have folder. client uploads docs in folder client search docs using window indexing service. above steps there in application. i making installer , want automate window indexing service on client machine. please help!! ideas welcome. have been googling, didn't found solution. i haven't used windows indexing, these promising places start: msdn: querying index programmatically msdn: windows search overview searching indexing service using windows indexing service

Amazon EC2 latency -

what's expected latency simple connection between pair of amazon ec2 instances in same region? thanks! the latency should similar latency of 2 computers in same lan. make sure using private ips when connecting 2 images , not public ones.

c# 2.0 - Unable to Pass parameters to MSI thro Msiexec via command prompt -

hii ppl trying pass parameter thro msiexec in command prompt . problem eventhough parameter passed value doesnt reflected in onbeforeinstallevent. therefore msi doesnt installed. the onbeforeinstall written c#.net framework 2.09 (vs 2005) , event call given below, string servername=context.parameters["servername"]. for example, in custom action parameter declared /servername=[servername] access server name. there no problem when install thro normal ui mode when pass parameter thro msiexec value doesnt reflected @ onbeforeinstall event. tried logging flow of installation thro msiexec /log , value gets changed in log ( shown below) property change: adding servername property. value 'machine1'. i have given below msiexec command use pass values, msiexec.exe /i "c:\server.msi" /l*v "c:\server.txt" allusers=1 reboot=reallysupress targetdir="c:\program files\server" servername="machine1" port="9090" but

xml - F1 Real time Data feeds -

i need write app gets data input real time foruma 1 racing data feed. feed i've come across till official 1 called "live timing", problem there's no documentation protocol (which seems binary protocol), tried contacting them didn't hear them yet. i've found .net library parses feeds it's based on reverse engineered version of real protocol has lot of bugs (and crashes). now i'm stuck, , since i'm not sport-expert thought maybe there alternative haven't found or heard of till now. any suggestion gonna helpful, please don't hesitate share know topic :) also, guys know of other sport's related real time data feed that's accessible developers ?

internet explorer - Porting ajaxified pages from IE to firefox/chrome -

i need port old ie-only ajax webapp more modern browser. differences in xmlhttprequest behavior should aware of? dom differences more important? any appreciated. not answer question, best thing port modern library jquery work in modern browser, including ie. it require rewrite large parts of application, resulting code simpler , smaller old one. jquery has shorthand notation , robust functions everyday use cases. for example, see jquery ajax functions

c - Problems Compiling OCILIB OCI Wrapper Library -

i'm trying compile demo in ocilib3.8.1/demo . after installing ocilib library, compile demo source conn.c below : #include "ocilib.h" int main(void) { oci_connection *cn; if (!oci_initialize(null, null, oci_env_default)) return exit_failure; cn = oci_connectioncreate("db", "usr", "pwd", oci_session_default); printf("server major version : %i\n", oci_getservermajorversion(cn)); printf("server minor version : %i\n", oci_getserverminorversion(cn)); printf("server revision version : %i\n\n", oci_getserverrevisionversion(cn)); printf("connection version : %i\n\n", oci_getversionconnection(cn)); oci_cleanup(); return exit_success; } compile using gcc : $gcc -wall conn.c -o conn.o -i/usr/local/include \ -doci_import_linkage -doci_charset_ansi error : $ gcc -wall conn.c -o conn.o -i/usr/local/include \ -doci_import_linkage -

Bing for Sharepoint? -

is possible add out-of-the-box bing site search box sharepoint extranet , have work? mind says no, since can't possibly index pages, right? wanted know thoughts. you can add bing search box , results pages site allowed anonymous access crawled bing. question when share point provides such wonderful search engine why need else crawling of internal content.

database - Why is MySQL (still) not taken seriously as a DBMS by many developers? -

in past years, i've run remarks mysql not being dbms take developers. i've been mysql user quite time , have trouble figuring out why developers against mysql. while i'm beginning believe part of these remarks true, small degree, i'm wondering real reasons why still think mysql inferior. i concurr found check constraints missing , booleans constrain integer in range of tinyint instead of true , false. additionally there current_timestamp issues don't like. these enough arguments tout mysql inferior dbms? real reasons here - if exist?

Grid of Checkboxes in WPF -

i have wpf usercontrol's datacontext tied class this: public class checkboxgridviewmodel { public list<list<bool>> checkboxes {get; set;} } i want display grid of checkboxes. i'm assuming can use itemscontrol, don't know how dynamic set of columns each row. this question seems answer mine, except answer didn't give example , can't figure how write out. so question is, how write xaml display checkboxes of checkboxes property lined in nice grid? the outer list each row , inner list each column of row. it's not clear if you're expecting each inner list same size if can use simple setup. using nested itemscontrols single row/column uniformgrids give distribution , automatically handle collections of size without needing setup row , column definitions grid: <itemscontrol itemssource="{binding checkboxes}"> <itemscontrol.itemtemplate> <datatemplate> <itemscontrol itemssource="{

winapi - in Python, how to separate Local Hard Drives from Network and Floppy in Windows? -

i've been looking info awhile, , have number of ways retrieve list of local drives under windows. here 2 examples: print win32api.getlogicaldrivestrings().split("\x00") and def getdriveletters(self): self.drvs = [] n_drives = win32api.getlogicaldrives() in range(0,25): #check drive letters j = 2**i # bitmask each letter if n_drives & j > 0: self.drvs.append(chr(65+i)+":/") print self.drvs what can't seem find way separate floppies (a:), usb drives (g:), cd drives (e:), , network drives (p:) local hard drives (c:, d:) if assigned same letters easy, i'm writing script monitor local hard disk space across network of computers different configurations. any appreciated! thanks. you can try win32 getdrivetype function. import win32file >>> win32file.getdrivetype("c:/") == win32file.drive_fixed ##hardrive true >>> win32file.getdrivetype("z:/") =

code contracts - Should methods have the same preconditions as the methods they call? -

i've had few scenarios small changes code have resulted in changing preconditions across multiple classes , wondering if design contract supposed way or not. public goal getnextgoal() { return goalstack.pop(); } if goalstack.pop() has precondition stack isn't empty, getnextgoal() need explicitly have same precondition? seems inheriting preconditions make things brittle, , changing queue or other structure change preconditions getnextgoal() , it's callers, , it's callers' callers. seems not inheriting preconditions hide contracts , callers, , callers' callers, wouldn't know preconditions. so brittle code callers know , inherit preconditions , postconditions of code call, or mysterious code callers never know deeper preconditions , postconditions are? it depends on calling method exactly. the important thing preconditions caller responsible fulfilling preconditions . so if callers of getnextgoal method should responsible providing no

html - CSS positioning of div elements -

i have form control i'm trying position on page. i've used absolute positioning works in ie. position off in firefox. idea on may doing wrong? #control-wrapper { position:relative; } #control { position:absolute; text-align:left; left:100px; top:790px; } <div id="control-wrapper"> <div id="control" class="hidediv"> <%html.renderpartial("mycontrol")%> </div> </div> you're nesting forms. that's forbidden. <!element form - - (%block;|script)+ -(form) -- interactive form --> — http://www.w3.org/tr/html4/interact/forms.html#h-17.3

c# - Anyone know how to put a .net control in a google maps InfoWindow? -

i looking @ basic google maps stuff , found following code on 1 of google's intro pages. i used poc , created .net project concept. have markers , infowindows being populated database pretty cool. my problem want add infowindows in slick way (not map, save db). instead of having .net controls outside of map window want able add info map directly. if user clicks in map able add marker , infowindow asp controls in window (textbox , button). anyone know how this? <html> <head> <title> title here </title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script> <script type="text/javascript"> function mapparamsinitialize() { var latlng = new google.maps.latlng(-34.397, 150.644); var myoptions = { zoom: 8, center: latlng,

.net - Is it possible to pause/resume the default music player from c# (maybe using the windows API) -

is there windows api command pause , resume default/current media player? if it, or need spoof keyboard input somehow? my reasoning... multimedia keyboards (or in fact modern usb keyboard) have pause buttons seem pause (commercial) music or video players (windows media player, spotify player , windvd respect command on current windows 7 , win xp machines). i'm guessing keyboard drivers aren't aware of these apps (besides which, haven't installed multimedia keyboard driver in decade), standard event being raised apps respondind to? what's event, , can raise (or cause raised) myself c#? at worst there must standard input usb human interface device standard? spoof that? you might consider simulating multimedia key press event in windows. it's not guaranteed work media software, many will. these 3 items may have pieces you'll need: how simulate multimedia key press (in c)? pinvoke.net: sendinput (user32) sendinput windows api c#

c# - Using Oracle.DataAccess.DLL already on PC, not providing it -

i looking make program more dynamic. able support oracle 10g , oracle 11g database same program. if build program using .dll reference 1 version other fails. there way use oracle.dataaccess.dll on computer being installed upon, instead of providing dll in installer? thanks in advance. specificversion attribute applies during build time. designed assist if there multiple versions of assembly in build environment; when specificversion true, ensure build against , reference desired version. once target assembly built, however, references contain strong name , version number of referenced assembly. so, if specificversion false, it's going set reference whatever available version of reference in build environment @ time. "note specific version property build-time directive, , has no effect on runtime version resolution of referenced assembly" (http://www.code-magazine.com/article.aspx?quickid=0507041&page=3). however, use version redirection explicitly a

php - Can't hold session values -

Image
i have written code login page , user page. when user provides correct username , password, code creates session variable rid , redirects user user page. but facing weird problem, session variable remains in login page when code redirects user page says notice: undefined variable: _session in /var/www/avatar/test1.php on line 6 . just check if session working tries output $_session['rid'] on both pages, displays rid on login page, on user page above error. so have created 2 sample pages test.php , test1.php . creating session variable in test.php , trying display in in test1.php . test.php : <?php $result=session_start(); $_session["searock"]="searock"; echo $result; echo $_session["searock"]; ?> <html> <body> <a href="test1.php">next</a> </body> </html> output : 1 searock next test1.php : <?php echo $_session["sea

google app engine - ImportError: cannot import name taskqueue -

i trying use appengine taskqueue api, import this: from google.appengine.api import taskqueue the code works online. when try run locally, error: importerror: cannot import name taskqueue i checked directory of appengine , didn't find file taskqueue.py explains error. there reason why file isn't included in appengine sdk? , there anyway install locally? wouldn't trust copying file folder, because sure depends on tens of other files. download , install current sdk. you're using older version.

Run specific code when overloading C++ operators -

i have class, let's call foo , contains 3 following methods (overloading left-associative < binary operator): ... operator<(a a) { return *this; } ... operator<(b b) { return *this; } ... operator<(c c) { return *this; } a, b, c classes not related in way(if that, of matter). now in program have 2 following cases: a = new a(); b b = new b(); c c = new c(); (first case): new foo() < < b; or (second case): new foo() < < b < c; whenever have first case (which ends b ), want execute function run() when have read(i know) b instance. idea have following code in foo class: ... operator<(b b) { run(); } now when have code of first case, run() being executed. the problem when have code in second case(which ends in c ). want execute run() function again not until know c is. if have previous piece of code run() called when doing < b not want don't know c yet. if add run() in operator<(c c) call run() twice. in f

iphone - Cancel NSOperation in for loop? -

i trying implement search on background thread using nsoperation on ios . didn't want subclass nsoperation i'm doing: [searchqueue cancelalloperations]; nsinvocationoperation *op = [[nsinvocationoperation alloc] initwithtarget:self elector:@selector(filtercontentforsearchtext:) object:self.searchdisplaycontroller.searchbar.text]; [searchqueue addoperation:op]; [op release]; the search method includes loop checks whether being searched in array. when cancel nsoperation calling cancelalloperations , loop continues run through array. prevent , wondering whether legit call within loop: if ([[[searchqueue operations] objectatindex:0] iscancelled]) { [tmp_array release]; // tmp_array used hold temporary results [pool drain]; // pool autorelease pool return; } one of reasons subclass nsoperation implement pro

android global hotkey -

how start activity on pressing global hotkey on android? possible, see button shortcut app. here solution 'search' button: <intent-filter> <action android:name="android.intent.action.search_long_press" /> <category android:name="android.intent.category.default" /> </intent-filter>

java - Unique Key Constraint -

what's best practice in handling data insertion/update on table unique key constraints at application level ? these came with: 1. run query on table before inserting data see if violate constraint. pros you have full control don't have deal dbms specific error messages. addtional layer of data integrity check cons there might performance hit since there no constraint violation of time. you need lock table while run query duplicate data. 2. nothing. update table , see sticks. pros simple! faster overall since don't have run additional query everytime update table. cons your validation routine depends on database layer. if data doesn't stick, have wade through stack trace find cause. which 1 more accepted solution? there alternatives these? i'm using java, jpa, hibernate, , spring btw. suggestions, framework specific, welcome! thanks! you've pretty sum up. if performance concern, go 2nd way. if integrity concern,

entity framework - Why the SQL Server CE 4 data connection is not listed in the DataConnection combo when I want to generate Database from Model? -

i doing tests entity framework using sql server ce 4 ctp2 , vs2010 pro. can create data connection without problems (as administrator) , see information of sample database northwind.sdf. when create new model (for example persons) , attempt generate database northwind.sdf using "generate database wizard", can't see connection related "microsoft sql server compact 4". microsoft sql server, microsoft sql server compact 3.5 , microsoft sql server database file listed. what think happening? thanks!!

r - Generating a very large matrix of string combinations using combn() and bigmemory package -

i have vector x of 1,344 unique strings. want generate matrix gives me possible groups of 3 values, regardless of order, , export csv. i'm running r on ec2 on m1.large instance w 64bit ubuntu. when using combn(x, 3) out of memory error: error: cannot allocate vector of size 9.0 gb the size of resulting matrix c1344,3 = 403,716,544 rows , 3 columns - transpose of result of combn() function. i thought of using bigmemory package create file backed big.matrix can assign results of combn() function. can create preallocated big matrix: library(bigmemory) x <- as.character(1:1344) combos <- 403716544 test <- filebacked.big.matrix(nrow = combos, ncol = 3, init = 0, backingfile = "test.matrix") but when try allocate values test <- combn(x, 3) still same: error: cannot allocate vector of size 9.0 gb i tried coercing result of combn(x,3) think because combn() function returning error, big.matrix function doesn't work either. test <-

iphone - Very basic objective-c question-how do I make different views share information? -

so, basically, have 4 different views switched via tab bar @ bottom of screen. have view controller set each one, , work fine. problem have no idea how share information between different views-for example, have ibaction on 1 takes output of uisegmentedcontrol , stores selection integer (1,2,3,4). problem is, don't know how access integer first view controller (the 1 stuff information). i'm sure basic problem google-fu doesn't seem working here. thanks! using mvc method, information should not stored in view controllers. should have separate object stores information, view controllers load it, , views display it. easiest way store information in application's delegate. then, whenever view controller needs find/change information, can use [[uiapplication sharedapplication] delegate] delegate, , load/change information needed. load information update display in viewdidload or viewwilldisplay:, , change in action methods. edit example: delegateclass.h

How to cast JSTL variable to string in Liferay JSP? -

i habe problem latest liferay portlet or rather jsp i'm using in portlet. using string array contains strings shown on page delete-button. each of these buttons calls actionurl submit selected data function. maybe it's easier understand want looking @ example code: <c:foreach var="name" items="<%=mynames %>"> <liferay-portlet:actionurl name="deletename" var="${name}"> <liferay-portlet:param name="myname" value="${name}" /> </liferay-portlet:actionurl> <c:out value="${name}" /> <liferay-ui:icon-delete label="<%= true %>" url="${name}"/> </c:foreach> maybe noticed problem is: var-attribute in actionurl has string. that's why example doesn't work. question now: how can cast $name variable dynamically set int actionurl , later call icon? thank you. <% list<string> names =

drupal table with the edit link -

i have table in drupal displays content table. have added edit link each record . link should take user input form has values populated in corresponding record. right populating form last row. for row x, need form populated values record x. the table created function _mymodule_sql_to_table($sql) { $html = ""; // execute sql $resource = db_query($sql); // fetch database results in array $results = array(); while ($row = db_fetch_array($resource)) { $results[] = $row; $email = $row['p1']; $comment = $row['p2']; } // ensure results exist if (!count($results)) { $html .= "sorry, no results found."; return $html; } // create array contain table rows $rows = array(); // list of column headers $columnnames = array_keys($results[0]); // loop through results , create table rows foreach ($results $key => $data) { // create row data $ro

Good Database Solutions for small-medium Traffic Sites and Silverlight -

what database solutions support silverlight , solid small-medium traffic website easy use/manage strong plus edit: forgot mention database needs smartphone-friendly, needs able work devices on ios, android, , windows phone 7 it depends on term small-medium. sql server express should suit needs. it free, database size cannot more 10 gb. limits resources can used server. http://www.microsoft.com/express/database/default.aspx

garbage collection - Does anyone know of a good guide to configure GC in Java? -

i'm having trouble jvm running app, heap memory looks comb. it's jumping 1.5 gb 3 gb , deteriorating higher values. i'm using g1 gc algorithm, have no idea how configure it. i not have access code of app i'm running and, needless say, it's rather large app. so, bottom line, know of guide configure gc in java? here tuning garbage collection 5.0 java virtual machine sun...oops oracle ;-) here link java 6

api - Problem creating event in Google Calendar with PHP cURL -

i'm trying add event php script using curl functions. it's not returning , events aren't being added calendar. can me out? this has stumped me last few days, appreciated. here's code: i have verified in xml, $title, , $eventinfo correct, , //combine last name, first name, , email address 1 variable set title event $this->httpheadersettings = array('content-type: text/xml', "authorization: authsub token=\"" . $sessiontoken . "\"") $title = $eventinfo['lname'] . ", " . $eventinfo['fname'] . ", " . $eventinfo['email']; //create atom feed send off google services event data $xmldata = "<entry xmlns='http://www.w3.org/2005/atom'" . "xmlns:gd='http://schemas.google.com/g/2005'>" . "<category scheme='http://schemas.google.com/g/2005#kind'" . "term='http://schemas.goo

python - input time in web2py -

i want take input time complete task in format no. of days,hours in web2py. there defined field,type in sqlfield. time module in python allows max 24 hours time. sorry field(...'time') allows 24 hours , there no specific type timeinterval. yet can make define 1 using: timeinterval = sqlcustomtype(....) and use as field('name',type=timeinterval, widget=....) you can make own widget handle it. please ask on web2py mailing list keep info in 1 place. happy provide complete example.

ruby on rails - Why am I getting this TypeError - "can't convert Symbol into Integer"? -

i have array of hashes. each entry looks this: - !map:hashie::mash name: connor h peters id: "506253404" i'm trying create second array, contains id values. ["506253404"] this how i'm doing it second_array = first_array.map { |hash| hash[:id] } but i'm getting error typeerror in pagescontroller#home can't convert symbol integer if try second_array = first_array.map { |hash| hash["id"] } i get typeerror in pagescontroller#home can't convert string integer what doing wrong? reading. you're using hashie, isn't same hash ruby core. looking @ hashie github repo, seems can access hash keys methods: first_array.map { |hash| hash.id } try out , see if works--make sure doesn't return object_id. such, may want double-check doing first_array.map { |hash| hash.name } see if you're accessing right data. then, provided it's correct, can use proc id (but bit more brevity): first_a

C++: Array with custom size in class -

i want this: class graphic { int *array; graphic( int size ) { int temp_array[size]; array = temp_array; glgentextures( size, array ); } } will work? , if will, there better way this? thanks. using new means have remember delete [] it; using compiler-dependent variable-size arrays means lose portability. it's better use vector . #include <vector> class graphic { std::vector<int> array; graphic( int size ) { array.resize(size); glgentextures( size, &array[0] ); } } the language guarantees vector elements contiguous in memory it's safe &array[0] here.

winapi - How to have service ImpersonateLoggedOnUser but with high mandatory integrity level? -

according blocking mouse input service in vista blockinput() requires high mandatory integrity level. also, service cannot make use of function since doesn't run on desktop. whenever occasional interaction desktop required, have service temporarily impersonateloggedonuser() , reverttoself() however, logged on user not administrator. how set integrity level high during impersonations can blockinput()? not figure out msdn documentation modifying token impersonateloggedonuser() takes. help? thanks [edit:] tried modifying impersonation code follows: previously, had code impersonates user access user's registry , files (and @ later point start user program createprocessasuser()): if (!wtsqueryusertoken(sid, &token)) throw "error: not logged on user token"; if (!duplicatetokenex(token, token_assign_primary | token_duplicate | token_query | token_adjust_default | token_impersonate, 0, securityimpersonation, tokenprimary, &usertok)) { closehandl

multithreading - How do I stop a Selenium server from an Ant task that I forked from a `java` target? -

i have written ant target starts selenium server, runs test code, , then... stop forked process (selenium). how keep track of forked thread ant created in order stop it? you should able shutdown selenium server direct web request to http://localhost:4444/selenium-server/driver/?cmd=shutdownseleniumserver the http task this.

html - passing data from javascript to servlet -

this question has answer here: call servlet , invoke java code javascript along parameters 3 answers i have values of checkbox , click delete values , type must sent servlet called deleteservlet. please me how send values? <html> <head> <script type="text/javascript"> function get_check_value(chkbox){ if(chkbox.checked){ var values=chkbox.value; //send values servlet } } function dodelete(theclick){ var type=theclick; //send type servlet alert(type); } </script> </head> <%string user=request.getparameter("users"); %> <body> <% string user[]=user.trim().split(" "); for(int i=0;i<user.length;i++){%> <center> <form name='list' action='adduserserv

wpf - what the name for the item in the green circle -

Image
what's element name in green circle? whta's event corresponding click element? interestingly, part of datagrid no-man's-land - doesn't have official name, let alone behaviour or template. in order handle events related area, see here or here .

c# - CalendarExtender in ASP.NET -

i using calendarextender control in asp.net web application. want disable control while clicking inside text box. using htmleditor (ajax control toolkit) inside same web page , have 1 script manager. have done following coding in order calendarextender in text box. when compile program don't errors, when click inside text box calendarextender not appear on web page. <%@ page language="c#" autoeventwireup="true" codefile="before_adm.aspx.cs" inherits="_default" %> <%@ register assembly="ajaxcontroltoolkit" namespace="ajaxcontroltoolkit" tagprefix="asp" %> <%@ register assembly="ajaxcontroltoolkit" namespace="ajaxcontroltoolkit.htmleditor" tagprefix="cc1" %> <%@ register assembly="ajaxcontroltoolkit" namespace="ajaxcontroltoolkit" tagprefix="asp" %> . . . <asp:textbox id="textbox3" runat="server&q

android - WebView download opens browser window for a short moment before returning to WebView -

my problem when hit pdf link in webview, browser opens short moment (i guess download linked file), pdf file starts download , app returns webview. there way stop browser window opening start download? i have used webviewclient shouldoverrideurlloading clicked urls kept in webview: private class linkwebviewclient extends webviewclient { @override public boolean shouldoverrideurlloading(webview view, string url) { view.loadurl(url); return true; } } and have download listener can download files (for needs these pdf's): webview.setdownloadlistener(new downloadlistener() { public void ondownloadstart(string url, string useragent, string contentdisposition, string mimetype, long contentlength) { intent intent = new intent(intent.action_view); intent.setdata(uri.parse(url)); startactivity(intent); } }); add mime type intent use startactivity() in d

c# - NetworkStream Pooling -

i have multi-threaded application communicates server on tcp connection. application deployed windows service. the way has been implemeted is, there controller creates communicator objects, assigns port number, message count etc. properties communicator , invokes startclient method commence dialog server. within startclient method, each communicator object creates connection server, using port number , url specified controller . after establishing connection, internally creates thread , calls readmessages method keeps reading server till message count met , gets closed down. based on runtime conditions, there might need reuse communicator object talk server again , hence, readmessages method woudl called again. initially, had been calling dispose() method networkstream, streamreader , streamwriter objects when readmessages method completed, reconnecting scenario, used throw "cannot access disposed object" error. so, commented out dispose method call t

delphi - sending mail but no message-id -

i getting interesting rejections clients mail server when sending mail indy-10's tidmessage component saying: 550 rejected: message not contain message-id i when using indy's own demo app http://www.indyproject.org/demodownloads/indy_10_mailclient.zip what do fix this. thanks! tidmessage in indy 10 intentionally omits 'message-id' header when encoding email socket or tstream. have use tidmessage.extraheaders property, eg: idmessage1.msgid := ...'; idmessage.extraheaders.values['message-id'] := idmessage1.msgid; edit: as followup - tidmessage has been updated logic changes in how handles "message-id" , "in-reply-to" headers: http://indyproject.org/sockets/blogs/changelog/20160912.aspx the tidmessage.msgid property generates "message-id" header regardless of whether email being saved, streamed, or transmitted. not need use extraheaders property anymore.

jquery - How can I create an editable combobox? -

i need populate combo box items database query (this part no problem). if user not find option, can enter own text , store in db index.. add new item store in db index value , display value db index , value. using jquery or javascript... help plz.. actually there plugin called jec product page demo jec on google code

JQGrid button in Master grid each row to load Detail grid -

Image
i testing example @ url : http://trirand.com/blog/jqgrid/jqgrid.html . right detail grid loading default id @ page load. requested functionality: i want detail button in each row when clicked should load detail grid. please tell me how. struggling that. you can use custom formatter or instert <botton type='button' ....> (or <input type='button' ...> ) respect of 'setrowdata' inside of loadcomplete or gridcomplete event handler . can find example if @ jqgrid demo , choose "row editing" / "custom edit". binding of onclick event can either in "row editing" / "custom edit" example or in unobtrusive way (see example here not same problem, hope understand mean) using jquery.click or jquery.bind . way instead of button can consider use link ( <a> or showlink ). inside of "click" handle can force loading of detail grid typically inside of onselectrow . updated : here see

c++ - Should you correct compiler warnings about type conversions using explicit typecasts? -

in current project, compiler shows hundreds of warnings type conversions. there lot of code this ivar = fvar1*fvar2/fvar3; // or ivar = fvar1*fvar2/fvar3+.5f; which intentionally assign float values int . of course, fix these warnings using ivar = (int)(...); but looks kind of ugly. would rather live ugliness or live warnings? or there clean solution? yes. you should fix compiler warnings. several reasons: *) may cause of error , need actual fix rather cast. won't know until look. *) actual coding errors manifest warnings can lost in noise generated hundreds of warnings *) makes clear other coders did mean use variable of wrong type/sign there. deliberate. *) makes clear , explicit type and/or signedness being changed. if variable names not contain indication of type , signedness may not obvious occurring.

php - Problems of using curl on windows compared to mac -

i use xampp apache run of php files. in 1 of php file use curl data external website, on windows machine, works fine. however, on mac machine, browser can not run files.. takes long load, , in end stop loading. attached 1 of php file: <?php $ch = curl_init(); curl_setopt($ch, curlopt_url, 'http://www.example.com'); curl_setopt($ch, curlopt_returntransfer, 1); $contents = curl_exec ($ch); curl_close ($ch); print $contents; ?> i desprate on why mac machine can not run these files? there way go doing on mac machine? help! edit: [solved] help. manage solve it, due, because connecting net using proxy server...thus script need handle that. code used: <?php $acontext = array( 'http' => array( 'proxy' =>'tcp://xxxxx:xx', 'request_fulluri' => true, ), ); $cxcontext = stream_context_create($acontext); $content = file_get_contents("http://www.example.com", false, $cscontext); print $content; ?> us

edit text in android -

hi want restrict special characters (!,@,#,$ etc.) entering in edit text field in android. how please body help.. thnx. you need use input filter , set on edit text setfilters method

rain plugin in jquery? -

i need breeze rain petals of flowers whole through website. showering show using snowfall jquery plugin. is there plugin shower rain or petals of flowers. how this: http://rain-demo.heroku.com/ library here: https://github.com/juliocesar/rain.js

design patterns - Is this better approach of creating Objects in Java than this? -

approach of creating objects at present, i have following structure abstract class a{ public abstract void b(); public abstract void c(); public abstract void d(); public void e(){ sample statements; } } public class z extends a{ public void b() { // todo auto-generated method stub } public void c() { // todo auto-generated method stub } public void d() { // todo auto-generated method stub } public void x() { sample statements;; whcih specific class; } } my question in above class z, dont want impl define method x specific to in same way define new class p, im other 2 methods not implemented. is right way implement way of creatin suit requirements create object? or there better approach go create i worried in class z, since methods c & d not unforeseen effects during programing later one more thought have got shall use factory design pattern implement same objects?

javascript - comma separated regex -

i have email regex happy with, lets call email. field validator looks var regex=/^email$/ but captain tells me wants allow comma separated emails in field. what first comes mind like /^(email)?(, email)*$/ but repeats email, offends senses. there way write regex without repeating email? this covers examples mentioned ^(email(,\s|$))+$ it matches email email, email but not emailemail

c++ - Eclipse CDT QT4 auto-complete not working -

i cannot auto-complete work eclipse cdt , qt4. whatever try, auto-complete not work me! can create , run qt gui applications no problem, plugin must installed... not know why auto-complete not work... matter, auto complete not work @ all? setting missing? thanks you have setup include paths in project properties, happen automatically if use pro file qmake , let eclipse import makefile based project.

how to stop wifi scan on android? -

is possible stop wifi scan started wifimgr.startscan() ? browse posts , read using thread give intervals between each result delivery. if want stop process, how can achieve it? i found answer few days ago. unregister receiver. don't know if best way go, works.

html - CSS bug in text input field - MSIE7 -

Image
i have input text in form has problem in msie7. when text field filled , continue typing, background starts scrolling left along text. this form when text field filled the background image, white rectangle rounded corners, scrolls left text, leaving black background. this css text field: border: none; background: url('/wp-content/themes/pokerbuddy/images/field.png') top left no-repeat; width: 100px; height: 20px; padding: 0px; font-size: 80%; color: #399; display:inline; is there way solve in msie7? input{overflow:hidden;} don't know if work.

iphone - what is the max length of the query string supported by the "mobile" safari browser? -

what max length of query string supported "mobile" safari browser? working on application have append records sqlite db remote database.i using aspx so.the current query string length 1 record comes upto 350 characters.is possible me send 200 records in query string(70,000 characters).i have read safari browser supports upto 80,000 characters.i wanted know if same mobile safari browser. appreciated! according this site , it's 80000 or more. have ensure server receives request supports this. instance if connect apache server, might run problems @ around 4000 characters. generally should try limit length of url. if need transmit lot of data it's better use http post data contained in body instead of in url.

c# - How to check if user have sucessfully logged in webrequest -

i have written code , executes provide username , password implements post dont know login sucessfull or not there way check that? var strid = username.text; var strname = userpass.text; var encoding = new asciiencoding(); var postdata = "maincontent_loginuser_username=" + strid + &maincontent_loginuser_password=" + strname + "&loginbutton"; byte[] data = encoding.getbytes(postdata); var myrequest = (httpwebrequest)webrequest.create("http://localhost:6226/website1/account/login.aspx"); myrequest.method = "post"; myrequest.contenttype = "application/x-www-form-urlencoded"; myrequest.contentlength = data.length; var newstream = myrequest.getrequeststream(); newstream.write(data, 0, data.length); newstream.close(); var response = myrequest.getresponse(); var responsestream = response.getresponsestream(); var responsereader = new streamreader(responsestream); textbox1.text = responsereader.readtoend(); you ne

android - Control volume keys -

in application have overridden onkeydown() , onkeyup() functions in order capture volume keys events. use such events in order control application volume. use music stream play sounds. when detecting event show custom toast (similar 1 shown android). problems i'm facing take are: android plays sound on volume keys events that sound played @ same intensity. what i'd control intensity @ default sound played (also stream on played) in following way: louder sound higher volume , lower sound low volume, if possible. or way disable playing default sound , play custom sound @ intensity set. actually sound played on onkeyup(...), can overload method in activity when gets called volume keys : @override public boolean onkeyup(int keycode, keyevent event) { if ((keycode == keyevent.keycode_volume_up) || (keycode == keyevent.keycode_volume_down)) { return true; } return super.onkeyup(keycode, event); } this worked me :)

java - Get attachments from a JAX-WS WebService with a JAX-RPC Client -

as migrate jax-rpc jax-ws i'm trying call webservice, uses jax-w/jaxb. client still using jax-rpc. wsdl file kept same. this works fine, long, there no attachments. attachments, doesn't work. client says, there none. although can seen in soap-message. as far understood problem, jax-ws use mtom put binary data message, while jax-rpc uses mime. is possible somehow work? here's how jax-rpc message looks: http/1.1 200 ok date: tue, 21 dec 2010 15:24:10 gmt transfer-encoding: chunked content-type: multipart/related;boundary="----=_part_6_5206227.1292945050584";type="text/xml";start="<soappart>" soapaction: "http://xxx" x-powered-by: servlet/2.5 jsp/2.1 014a ------=_part_6_5206227.1292945050584 content-type: text/xml; charset=utf-8 content-transfer-encoding: 8bit content-id: <soappart> <env:envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:header/><env:body><operat

html - Keygen tag in HTML5 -

so came across new tag in html5, <keygen> . can't quite figure out for, how applied, , how might affect browser behavior. i understand tag form encryption, difference between <keygen> , having ssl certificate domain. also, challenge attribute? i'm not planning on using far implemented in acceptable range of browsers, curious tag does. can find vague cookie-cutter documentation no real examples of usage. edit: i have found informative document, here . runs through both client-side , server-side implementation of keygen tag. i still curious benefit of on domain ssl certificate be. ssl "server identification" or "server , client authentication (mutual authentication)". in cases server presents server-certificate during ssl handshake make sure server expect connect to. in cases server wants verify you person pretend be. need client-certificate. the <keygen> tag generates public/private key pair , creates c