Posts

Showing posts from September, 2014

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.

java - JXL Hide a Sheet on creation -

jxl hide sheet my requirement i need create sheet , make hidden ( using jxl api) . later program populate values in hidden sheet reference sheet. can 1 tell me how hide sheet using jxl api. regards, n.s.balaji try calling: sheet. getsettings() . sethidden(true) ;

Any recommendations for streaming audio from grails app? -

i'm trying stream audio file grails app. audio file in mp3 format. i couldn't find examples or hints on net, recommendations? the soundmanager plugin might useful. i've never used personally.

php - Posting not working via JS (Jquery) but is with form -

i have rather confusing problem. i have php file (http://example.com/delete.php) <?php session_start(); $user_id = $_session['user_id']; $logged_in_user = $_session['username']; require_once('../classes/config.php'); require_once('../classes/post.php'); $post = new post(null,$_post['short']); #print_r($post); try { if ($post->user_id == $user_id) { $pdo = new pdoconfig(); $sql = "delete posts id=:id"; $q = $pdo->prepare($sql); $q->execute(array(':id'=>$post->id)); $pdo = null; } else {throw new exception('false');} } catch (exception $e) { echo 'false'; } ?> and i'm trying jquery post data it, , delete data. $('.post_delete').bind('click', function(event) { var num = $(this).data('short'); var conf = confirm("delete post? (" + num + ")"); if (conf == true) { var invalid

c# - Split a string by capital letters -

possible duplicate: regular expression, split string capital letter ignore tla i have string combination of several words, each word capitalized. example: severalwordsstring using c#, how split string "several words string" in smart way? thanks! use regex (i forgot stackoverflow answer sourced it, search now): public static string tolowercasenamingconvention(this string s, bool tolowercase) { if (tolowercase) { var r = new regex(@" (?<=[a-z])(?=[a-z][a-z]) | (?<=[^a-z])(?=[a-z]) | (?<=[a-za-z])(?=[^a-za-z])", regexoptions.ignorepatternwhitespace); return r.replace(s, "_").tolower(); } else return s; } i use in project: http://www.ienablemuch.com/2010/12/intelligent-brownfield-mapping-system.html [edit] i found now: how convert camelcase human-reada

jquery - How to implement JSONP in ASP.NET application -

can suggest, how can implement jquery jsonp in asp.net project . using jquery ajax , sorry new jsonp implementation. application flow described below: 1) opening http page, have got jquery login dialog box, username , password posted login.aspx page, has got 1 method "getlogindetails" takes posted username , password , sends webservice checks users name , password , return "success=true" 2) in response "success=true", read value jquery , works according responded text on client side display message "logged in successfully" . please suggest how can achieve above functionality using jquery jsonp , .net.

PHP: Lock all MySQL tables in PHP -

how can tables in mysql database in php? im sure there must way it, cant seem find php functions job. looking this lock_all_mysql_tables(); //.... calling external functions require db lock unlock_all_mysql_tables(); i'm not sure if there absolute way of doing require can list of tables in database... mysql: show tables ... run foreach loop on results lock/unlock each table.

iphone - NavigationBar hidden in detailViewController when presented modally -

i presenting detailviewcontroller modalview.in modalview navigation bar never visible, though not hiding where.please help! writereviewcontroller *newreview = [[writereviewcontroller alloc] initwithnibname:@"writereviewcontroller" bundle:nil]; uinavigationcontroller *modalnavcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:newreview]; // intended presented in view controller class modalnavcontroller.navigationbar.barstyle = uibarstyledefault; [self.parentviewcontroller presentmodalviewcontroller:modalnavcontroller animated:yes]; [modalnavcontroller release]; this code worked me

osx - How can I increase the cursor speed in terminal? -

how can increase cursor speed in terminal? have mac os x way. interesting know linux. i don't know should search in google (or like). if "cursor speed", mean repeat rate when holding down key - have here: http://hints.macworld.com/article.php?story=20090823193018149 to summarize, open terminal window , type following command: defaults write nsglobaldomain keyrepeat -int 0 more detail article: everybody knows can pretty fast keyboard repeat rate changing slider on keyboard tab of keyboard & mouse system preferences panel. can make faster! in terminal, run command: defaults write nsglobaldomain keyrepeat -int 0 then log out , log in again. fastest setting obtainable via system preferences 2 (lower numbers faster), may want try value of 1 if 0 seems fast. can visit keyboard & mouse system preferences panel undo changes. you may find few applications don't handle extremely fast keyboard input well, fine it.

ASP.Net httpruntime executionTimeout not working (and yes debug=false) -

we noticed executiontimeout has stopped working on our website. working ~last year ... hard when stopped. we running on: windows-2008x64 iis7 32bit binaries managed pipeline mode = classic framework version = v2.0 web.config has <compilation defaultlanguage="vb" debug="false" batch="true"> <httpruntime executiontimeout="90" /> any hints on why seeing timetaken way ~20 minutes. compilation options debugtype (full vs pdbonly) have effect? datetime timetaken httpmethod status sent received 12/19/10 0:10 901338 post 302 456 24273 12/19/10 0:18 1817446 post 302 0 114236 12/19/10 0:16 246923 post 400 0 28512 12/19/10 0:12 220450 post 302 0 65227 12/19/10 0:22 400150 200 180835 416 12/19/10 0:20 335455 post 400 0 36135 12/19/10 0:57 213210 post 302 0 51558 12/19/10 0:48 352742 post 302 438 25802 12/19/10 0:37

Writing a DSL like Thor gem in Ruby? -

i'm trying figure out how thor gem creates dsl (first example readme) class app < thor # [1] map "-l" => :list # [2] desc "install app_name", "install 1 of available apps" # [3] method_options :force => :boolean, :alias => :string # [4] def install(name) user_alias = options[:alias] if options.force? # end # other code end desc "list [search]", "list of available apps, limited search" def list(search="") # list end end specifically, how know method map desc , method_options call to? desc pretty easy implement, trick use module.method_added : class descmethods def self.desc(m) @last_message = m end def self.method_added(m) puts "#{m} described #{@last_message}" end end any class inherits descmethods have desc met

Can the controls in the toolbox be used in both Winform and WPF application? -

if not, how can know controls used in winforms, controls used in wpf? if develop winforms application, wpf controls not shown in toolbox, , vice versa. if want use winforms control in wpf application anyway, there's windowsformshost wpf control that. hosting wpf control in windows forms app, can use system.windows.forms.integration.elementhost control.

java - problem in concurrent web services -

hi have developed web services. getting problem when 2 different user trying access web services concurrently. in web services 2 methods there setinputparameter getuserservice suppose time user operation 10:10 user1 setinputparameter 10:15 user2 setinputparameter 10:20 user1 getuserservice user1 getting result according input parameter seted user2 not ( him own ) i using axis2 1.4 ,eclipse ant build, services goes here user class service class service.xml build file testclass package com.jimmy.pojo; public class user { private string firstname; private string lastname; private string[] addresscity; public string getfirstname() { return firstname; } public void setfirstname(string firstname) { this.firstname = firstname; } public string getlastname() { return lastname; } public void se

c++ - When should this-> be used? -

i wondering if this-> should used both: void someclass::somefunc(int powder) { this->powder = powder; } //and void someclass::somefunc(bool enabled) { this->isenabled = enabled; } i'm wondering if latter necessary proper or if isenabled = enabled suffice. thanks this-> is needed when using member directly ambiguous. happen template code. consider this: #include <iostream> template <class t> class foo { public: foo() {} protected: void testing() { std::cout << ":d" << std::endl; } }; template <class t> class bar : public foo<t> { public: void subtest() { testing(); } }; int main() { bar<int> bar; bar.subtest(); } this fail since calling testing() dependent on template parameter. mean function have this->testing(); or foo<t>::testing(); error message: temp.cpp: in member function ‘void bar<t>::subtest()’: temp.cpp:16:32: error:

Git svn work flow, making branchs in git-svn -

git version 1.7.3.3 i had project using git. our company changed policy , wanted switch svn. so imported project in subversion using standard layout (trunk, branchs, , tags). so current workflow following: make changes, put them in staging area, commit them git. however, little confused when comes svn. first rebase latest changes subversion. dcommit. i.e. stage change files git stage app_driver.c commit them git git commit -m"added changes" get latest changes svn git svn rebase commit latest changes svn git svn dcommit push changes git repository git push upstream my_project however, real confusion comes when make new branch in git, , how can commit branch in subversion. git checkout -b add_new_feature then how make new branch in svn , commit it? many suggestions, what create branch in subversion using svn copy. for example, suppose trunk in https://svnserver/svn/myproject/trunk , want create branch in https://svnserver

c# - Async calls with new keyword 'await' -

i've used async methods today, calling methods asynchronously , using caller's callback methods. recently, can across this post talks new way using new await keyword. other saving few lines of code, main advantages of new model? does offer built in solution when make 2 different async calls want control return 1 of caller's callback, after both have completed? what ctp (community technical preview) mean? new keyword available in next version of c# , vb.net? from eric lippert's blog post asynchrony in c# 5, part one the designers of c# 5.0 realized writing asynchronous code painful, in many ways. asynchronous code hard reason about, , we've seen, transformation continuation complex , leads code replete mechanisms obscure meaning of code. as article explains iterator blocks, anonymous methods, query comprehensions , dynamic types intent make hard, easy. as community technical preview bit. typically means "await" i

c# - How to use XNA in WPF? -

so... want make game, , want write in c#. in past, i've made mario clone using c++ , opengl. quite opengl, don't know how it's supported inside c#/wpf. also, might beneficial use actual game library? guess xna the game library c#, maybe i'll invest bit of time learning that. however, want use wpf form controls level editor... there way can embed xna (directx?) window inside wpf app? specifically, don't need buttons or things inside xna/directx widget, around it, no mixing required...just need graphics widget in wpf form. nick gravelyn explains how on blog. although, if it's editor, may find using winforms easier , better supported.

c++ - Scintilla: How do you find the byte position given a specific character position -

given specific character index on line, e.g. 10th character on line 3, there easy way calculate scintilla's 'position' of character? it's straight forward when using ascii characters can't see easy way when using multi-byte utf-8 characters, single character may take several byte positions. convert line text utf8 , count byte positions. cache conversion if multiple requests may made.

browser - C# WebBrowser get mouse click position -

i have webbrowser class , image loaded in it. after mouse click on browser, need mouse position - best way it? this pretty simple if looking screen coordinates. // should in form initialization this.mouseclick += new mouseeventhandler(mouseclickevent); void mouseclickevent(object sender, mouseeventargs e) { // whatever need e.location } if strictly looking point in browser, need consider functions browser.pointtoclient(); browser.pointtoscreen();

php - MySQL Date comparison advice -

i'm setting script run daily , check members meet age - automated emails can set in cms , assigned sent @ age, either in months or years. handle via php , mysql, number of months passed parameter method, deal below. however, i'm not sure i'm going in easiest way! partly because of formatting of uk date format, i'm converting string datetime unix timestamp make comparison. can find better way of going this? thanks // if num of months provided year, make calculation based on exact year if ($age_in_months % 12 == 0) { // using 365 days here (60 * 60 * 24 * 365 = 3153600) $clause = 'where round((unix_timestamp() - unix_timestamp(str_to_date(dob, "%d/%m/%y"))) / 31536000) = ' . $age_in_months; } else { // using 30 days avg month length (60 * 60 * 24 = 86400) - convert months days $clause = 'where round((unix_timestamp() - unix_timestamp(str_to_date(dob

C# UseVisualStyleBackColor -

Image
is there way in can change button color , preserve windows visualstyle? want create button looks checkbox2 (color , style) this.button2.backcolor = system.drawing.systemcolors.gradientactivecaption; this.button2.usevisualstylebackcolor = false; //if true, backcolor gets ignored no, not really. kind of button background drawn visualstylerenderer.drawbackground(). in turns pinvokes drawthemebackground(). these methods don't take color. none needed because color specified in theme. simulating appearance lineargradientbrush real hope. note custom drawing button quite difficult, code internal , no owner-draw provided. consider using image.

java - Converting to JSTL (Specificlly on calling methods) -

i'm in process of going full jstl way, , i've got issue following scriplet, have transformed variable displaying , conditions expression language (el) i'm not sure of how method calling : here's jsp code positioned before html markup: userdto user = (userdto) session.getattribute("user"); orderdao lnkorder = new orderdao(); orderdto order = new orderdto(); coverdao lnkcover = new coverdao(); coverdto cover = new coverdto(); upgradesdao lnkupgrades = new upgradesdao(); upgradesdto upgrades = new upgradesdto(); orderaccessoriedao lnkorderacc = new orderaccessoriedao(); list<orderaccessoriedto> orderaccessories = new arraylist<orderaccessoriedto>(); groupcolorsdao lnkcolors = new groupcolorsdao(); list<colordto> colorlist = new arraylist<colordto>(); colorlist = lnkcolors.getgroupcolors(user.getgroup()); accessorydao lnka

.htaccess - htaccess - RewriteRule for static files -

how rewrite urls images , other static files specific folder, i.e. using far: rewriterule \.(woff|ttf|svg|js|ico|gif|jpg|png|css|htc|xml|txt)$ /myfolder/$1 but not working, please help. ------------------- update --------------------- ok have: rewritecond %{http_host} ^(www.)?exmpale.com$ rewritecond %{request_uri} !^/exmpale.com/ rewriterule ^(.*\.(woff|ttf|svg|js|ico|gif|jpg|png|css|htc|xml|txt))$ /exmpale.com/$1 rewritecond %{http_host} ^(www.)?exmpale.com$ rewriterule !\.(woff|ttf|svg|js|ico|gif|jpg|png|css|htc|xml|txt)$ /exmpale.com/index.php so images redirected exmpale folders work rewrite else index.php, above solution not working far. cheers, /marcin maybe want: rewriterule ^(.*\.(woff|ttf|svg|js|ico|gif|jpg|png|css|htc|xml|txt))$ /myfolder/$1 or perhaps this: rewriterule ([^/]*\.(woff|ttf|svg|js|ico|gif|jpg|png|css|htc|xml|txt))$ /myfolder/$1 if neither of you're looking please add details examples of desired inputs/outputs. as upda

java - should an applet or an application catch Error exceptions? -

should applet or application catch error exceptions? i think both can it. any help? no. error s runtime errors outside of control (eg, outofmemoryerror ). error s unchecked. don't need catch them or declare them, because can happen @ literally point in application. and, when happen, means sky falling, , nothing fix them. in fact, in cases, can't safely @ all. if computer out of memory, can't log it. so, it's best not worry them.

collaboration - How to let people collaborate on my open source project? -

a while ago started open-source project, me meant (until now) pushed source code public repository (mercurial on google code). though, i've received requests other people collaborate on project. having never collaborated on open-source project before, i'm not sure how proceed: do give them access repository can push changes? if push don't can roll , if on nerves can revoke access repository. do tell them send in patches (via issue tracker) , apply ones , revoke ones don't? now: i don't want lose ownership of project. it's pretty nice project , it's resume material. think afraid of. however, want give proper credit collaborators. i know whole point of open-source: collaboration, don't want idiot , no these people want help. lately haven't had time code on project, use help. also, i'm bit reluctant let work on project. if they're, pardon expression, noobs? suppose can rollback they're changes , tell them to, pardon expres

java - guava-libraries: is Iterators.cycle() thread-safe? -

suppose have following class: public class foo { private list<integer> list = lists.newarraylist(1, 2, 3, 4, 5); private iterator<integer> iterator = iterators.cycle(list); public void bar(){ integer value = iterator.next(); dosomethingwithaninteger(value); } } if instance of foo acessed simultaneously 2 threads, need each thread gets different value iterator.next() . bar() method have made synchronized? or iterator.next() guaranteed thread-safe? in example, using arraylist underlying iterable. thread-safety of cyclic iterator depend on specific iterable implementation? thank you. pretty nothing in guava guaranteed thread safe unless documented such. you not have synchronize entire bar method, should wrap call iterator.next() in synchronized block. eg: public void bar(){ integer value; synchronized (iterator) { value = iterator.next(); } dosomethingwithaninteger(value); }

vb.net - How do I write a unit test that verifies a subroutine is called? -

public class class1 public output string = "" public storethis string = "" public function giveoutput(byval s string) string output = s + " output" if s = "s" callthis() end if return output end function public sub callthis() ///pretend useful going on here end sub end class granted example pretty weak, how write test method prove callthis() gets called everytime input parameter s = "s"? if useful happens in callthis , can detect side effect in test code. for example, if variable changes value in specific way function, can test value before , after call.

objective c - How to make something like iPhone Folders? -

Image
i'm wanting know if there's way can transform view iphone folders. in other words, want view split somewhere in middle , reveal view underneath it. possible? edit: per suggestion below, could take screenshot of application doing this: uigraphicsbeginimagecontext(self.view.bounds.size); [self.view.layer renderincontext:uigraphicsgetcurrentcontext()]; uiimage *viewimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); not sure this, however. edit:2 i've figured out how add shadows view, , here's i've achieved (cropped show relevant part): edit:3 http://github.com/jwilling/jwfolders the basic thought take picture of current state , split somewhere. animate both parts setting new frame. don't know how take screenshot programmatically can't provide sample code… edit: hey hey it's not looking great works ^^ // wouldn't sharp on retina displays, instead use "withoptions" , set scale

asp.net - style a textbox into the following format? -

i have field called water meter reading(right textbox take 6 numbers) on html page, need change format display [][][][][][] (6 separate small (single digit forms)).... 6 fields required , need number. finally should this. water meter reading:* [][][][][][] any suggestions how display values this. if understand question correctly seems me want 6 separate fields, water_meter_reading_1 through water_meter_reading_6 , can combine them 1 field water_meter_reading when form submitted server. consequently load data 6 fields if need edit form can split field water_meter_reading on server side appropriate field.

xcode - UIDeviceRGBColor isEqualToString:]: unrecognized selector -

can tell me about? have table , inside tablecell have pickerview , textfields in other cells. when i'm scrolling table , down 8-10 times app crashes , gives me error: * terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[uidevicergbcolor isequaltostring:]: unrecognized selector sent instance 0x5834850' short answer: trying call -isequaltostring: on instance of uidevicergbcolor, doesn't respond it. long answer: you're either asking wrong object @ point, or quite possibly trying access object has been released, who's pointer has not been set nil. when happens you'll straight crash memory in new location isn't proper object. new object takes place. best way find out turn on zombies. this overview of how use zombies: http://iosdevelopertips.com/debugging/tracking-down-exc_bad_access-errors-with-nszombieenabled.html you may start seeing messages saying "-[nscfstring isequaltostring:] message sent

python - a question on using xhtml2pdf to parse css from website -

i trying use xhtml2pdf convert webpage pdf. after reading out content of webpage using urllib2, found pisa.createpdf needs process every link in webpage content too. especially, whenever tried parse .css file after tried several websites, got following error: pisa-3.0.33-py2.6.egg/sx/w3c/cssparser.py", line 1020, in _parseexpressionterm sx.w3c.cssparser.cssparseerror: terminal function expression expected closing ')':: (u'alpha(opacity', u'=0); }\n\n\n\n.ui-state-') do seem issue too? please help? lot. pisa-3.0.33-py2.6.egg/sx/w3c/cssparser.py", line 1020, in _parseexpressionterm sx.w3c.cssparser.cssparseerror: terminal function expression expected closing ')':: (u'alpha(opacity', u'=0); }\n\n\n\n.ui-state-') i think because didn't recognize css, alpha(opacity bla.. bla i having problem before because of javascript, removed them , works.

php - Javascript sending data via POST in firefox addon -

i have mysql database, php form. normally, people use php form on website add mysql database. have been building firefox addon let them use form without visiting site directly add data mysql database. stuck... i have form data want add mysql database, how can send mysql database addon? what's best way this? send php form first or there direct way? possible go straight mysql? firefox addon coded in javascript. thanks! jan hančič right : best way use xmlhttprequest. here's example : var xhr = new xmlhttprequest(); xhr.open("post", "http://ex.ample.com/file.php", true); xhr.onreadystatechange = function() { if(this.readystate == 4) { // this.responsetext } } xhr.send("var1=val1&var2=val2"); there plenty of tutorials , references on web ajax , xhr object.

javascript - Google Maps API: Get url for current view -

i have form users can introduce google maps urls specify address of stuff. i've been thinking in showing map through google map api v3, letting user move desired location , through button or automatically url of place , copy input. i've been able display map using tutorial, haven't been able find in documentation how url... i think not need it, simple code i'm using: var latlng = new google.maps.latlng(-34.397, 150.644); var options = { zoom: 8, center: latlng, maptypeid: google.maps.maptypeid.roadmap, maptypecontrol: false }; var map = new google.maps.map(document.getelementbyid('map-box'), options ); i'd suggest using map.getcenter().tourlvalue() , map.getzoom() obtain centre , zoom state of current map view. information should let build uri can use, bare in mind you'll need write code take values off uri , pass them map api.

multithreading - Multi-threading in MATLAB -

i have read matlab's info on multi-threading , how in-built in functions. however, requirement different. say, have 3 functions: fun1(data1), fun2(data2), fun3(data3).... can implement multi-threading between these functions? have 300+ functions using lot of data. multi-threading may me cut down lot of time. please suggest command or can further research on. thanks! if want run batch of different functions on different processors, can use parallel computing toolbox, more specifically, parfor loop, need pass functions list of handles. funlist = {@fun1,@fun2,@fun3}; datalist = {data1,data2,data3}; %# or pass file names matlabpool open parfor i=1:length(funlist) %# call function funlist{i}(datalist{i}); end edit: starting r2015a matlabpool function has been removed matlab, need call parpool instead.

PHP: is_array on $arr['key'] with non existing 'key' -

one of colleges seem have 'undefined index' error on code wrote this code of mine looks this: if ( is_array ($arr['key'])) my intention check whether $arr has key named 'key', , if value of key array itself. should instead: if( isset($arr['key']) && is_array ($arr['key'])) ? maybe following equivavlent: let's assume $var not set. then, is_array($var) cause error or return false? thank you yes, use isset , is_array . if(isset($arr['key']) && is_array($arr['key'])) { // ... } because php uses short-circuit logic evaluation, stop before gets is_array() , you'll never error.

CSS layout with header and colums top to bottom -

greets, i'm working on website , have stumbled upon layout difficulties. want website header (fixed hight) , followed 3 columns (left, middle, left). want columns stretch top bottom. when set them 100% height, page gets overflow static header on 140px. have included image of page lots of colors show divs ( http://oi51.tinypic.com/974rqd.jpg ). any appreciated! this should solve problem: http://www.cssplay.co.uk/layouts/three-column-layouts.html

winapi - C++ -- Win32 API, GUI stuff -

i've been messing win32 api abit, , i've got question regarding gui functions. how 1 handle user input not managed through popup windows? i've been reading http://www.winprog.org/ right when interesting features comes -- lesson9 -- becomes more abstract , i'm not sure how it. after user write input in 2 windows , press button send message content of input processed. think input windows edit-class windows , input button-class that's it. any ideas? i'm sure it's simple, it's makes me want rip hair of in native code :p cheers you're correct, want , edit control more commonly known textbox , button class command button. to the input button send wm_command message parent window bn_clicked in wparam high word. can identify particular button hwnd in message. after you'll need post wm_gettext edit control retrieve users input. this memory highly recommend looking msdn pages before code.

Rails 3: Why the field with error is not wrapped with "field_with_errors" div when validation fails? -

my product class has price field, has appropriate column in products table in database, , new_shop helper field (which defined attr_accessor , , not has appropriate column in products table in database). when validation on price fails, input field wrapped field_with_errors div, when validation on new_shop fails, not wrapped field_with_errors div. why ? here generated html these input fields: <input type="text" name="product[price]" id="product_price"> <input type="text" value="" name="product[new_shop]" id="product_new_shop"> some more info: class product < activerecord::base attr_accessor :new_shop accepts_nested_attributes_for :shop validates_presence_of :price ... end class shop < activerecord::base validates_presence_of :name ... end when form submitted, new_shop value passed product's shop_attributes[:name] . so it's :name attribute fai

android - how to create layout for dayview, weekview calendar? -

i want create layout this: dayview dose can tell me layout should used make day view calendar that. i'm going using absolute layout process overlap widget it's not recommended. try using gridview, or maybe tablelayout. to borders try trick: android gridview separator it's not clear part of screen have problems recreating, figured part in middle grid. br, vanja

web applications - Let person login to google docs automatically -

i write web application allow person1 create document on google docs , share person2. a problem: when person2 click on link of shared document, google alway redirect login page. i can store person2 username , password in database, there way let person2 login google docs automatically? i don't think you're asking supported google's free services. closest thing single-sign-on , seems available google apps business/education. they have other options not you're asking. example use google openid log you're web site. using approach user logged google while browsing site, , therefore won't bothered google login page when navigate google spreadsheet. you can use username/password access google spreadsheet api , gets access data, not gui.

biztalk - Debatch the Incoming message and create fixed batch of input messages in the orchestration? -

http://blogs.msdn.com/b/brajens/archive/2006/07/20/biztalk-custom-receive-pipeline-component-to-batch-messages.aspx i following above article, want implement in orchestration how can implement please advise, here of thoughts know. using foreach loop. a)read each single message , added new message until reaches fixed batch b) using xpath position / [local-name()='root' , namespace-uri()='http://mycompany.com']/ [local-name()='content' , namespace-uri()='' , position() >= 0 , position < fixed size] (which not working) call custom pipline component ( above) first of guyz valuable replies, right implemented in orchestration using foreach loop, xpath(toget count , single input node) , message variable (created new unbounded message assign concatenated fixed no of input messages). working fine now. do guyz agree appoach or have concerns? the best solution indeed use custom pipeline component such 1 linked in questio

c++ - pass method with template arguments to a macro -

i unable use google test's assert_throw() macro in combination multiple template arguments. consider want make sure construction of matrix<5,1> throws: assert_throw(matrix<5,1>(), std::runtime_error); (this example doesn't make lot of sense, of course shoud not throw, stayed after simplifying had.) i output ms vc++ 2008: warning c4002: many actual parameters macro 'assert_throw' error c2143: syntax error : missing ',' before ';' whereas there no problems with: assert_throw(matrix<1>(), std::runtime_error); how can overcome problem? thanks! the problem comma, need protect macro. try assert_throw((matrix<5,1>()), std::runtime_error);

php - SugarmCRM REST API always returns "null" -

i'm trying test out sugarcrm rest api, running latest version of ce (6.0.1). seems whenever query, api returns "null", nothing else. if omit parameters, api returns api description (which documentation says should). i'm trying perform login, passing parameter method (login), input_type , response_type (json) , rest_data (json encoded parameters). following code query: $api_target = "http://example.com/sugarcrm/service/v2/rest.php"; $parameters = json_encode(array( "user_auth" => array( "user_name" => "admin", "password" => md5("adminpassword"), ), "application_name" => "test", "name_value_list" => array(), )); $postdata = http_build_query(array( "method" => "login", "input_type" => "json", "response_type" => "json", "rest_data"

javascript - Storing IDs of table rows -

sorry bother of again. still haven't found working answer problem. i have old fashioned html table. each reach has unique id. want achieve javascript id gets stored in variable once cklick link on each row. might sound easy you, new js , can't figure out end. me please? thanks! the onclick event of clicking on can call function function recordclick( elem ) { mylocalvar = elem.id; } by saying onclick="recordclick(this);"

oop - PHP - Is this the factory method pattern? -

i saw resource online http://www.labelmedia.co.uk/blog/posts/design-patterns-factory-method.html from know not pattern. it's more of mix between the simple factory idiom , simple factory method. did wrong ? hmm, yes. looks more simple factory indeed. however, might refering called "static factory method" .

editor - meta tag text/html;CHARSET=x-mac-roman -

which editor adds html files creates? pretty mac program. <meta http-equiv="content-type" content="text/html;charset=x-mac-roman"> i have page let's users upload html file, , htmlagility chokes on this... i'm curious tag comes from, i've never seen it.. sam it comes billgates' ripoff word when runs on macos , user writes word document chooses 'save webpage'. stupid thing web page produced shows beautifully in firefox gates' own ie mucks accents (i've been struggling trying iron out problem text written in french).

c++ - Cannot link streams code with gcc -

i have problem compiling following code: // writing on text file #include <iostream> #include <fstream> using namespace std; int main () { ofstream myfile ("example.txt"); if (myfile.is_open()) { myfile << "this line.\n"; myfile << "this line.\n"; myfile.close(); } else cout << "unable open file"; return 0; } to compile: g++ -c -o2 -wall -wno-unused -fexceptions -i. -i../../../stub -d_reentrant -d_thread_safe -i. -o t.o ./test.cc g++ -o t -o2 -wall -wno-unused -fexceptions -wl,-brtl -wl,-blibpath:/lib:/usr/lib t.o -lpthreads the compile gives warnings: ld: 0711-224 warning: duplicate symbol: .__divdi3 ld: 0711-224 warning: duplicate symbol: .__moddi3 ld: 0711-224 warning: duplicate symbol: .__udivdi3 ld: 0711-224 warning: duplicate symbol: .__umoddi3 ld: 0711-224 warning: duplicate symbol: .__udivmoddi4 ld: 0711-345 use -bloadmap or -bnoquiet option obtain more information.

windows - What is the recommended way to package perl scripts for CPAN (and CorporatePAN)? -

recently looked @ module on cpan comes script installed made me wonder. recommended way include script in package should end on public cpan , if there different recommendation packages released on in-house cpan server? the script starts this: #!/usr/bin/perl eval 'exec /usr/bin/perl -s $0 ${1+"$@"}' if 0; # not running under shell two questions do understand correctly eval part unnecessary? embedded cpan client during installation , different when installing on windows. what recommended sh-bang line? #!/usr/bin/env perl instead of above? just use #!/usr/bin/perl (or, optionally, whatever path perl on development machine.) when module::build or makemaker installs script, change #! line match perl installing module. add "eval exec" lines, except under windows, create .bat file instead. (the cpan client has nothing this.) if use #!/usr/bin/env perl then installers won't realize that's perl script, , not

RIA Domain service returns null although NHibernate DAL returns data -

hi i've got following method in nhibernate dal: public iqueryable<workcellloadgraphdata> getworkcellloadgraphdatabyid( string workcellid, datetime startdate, datetime enddate ) { var workcellgraphdata = ( x in this.getsession().query<workcellloadgraphdata>() x.workcellid == workcellid && (x.fromtime >= startdate && x.fromtime <= enddate) select new { x.workcellid, x.calendarid, x.fromtime, x.durationinminutes }); return workcellgraphdata iqueryable<workcellloadgraphdata>; } when put breakpoint on workcellgraphdata, collection of workcellgraphdata objects. however, calling code, in ria domain service class, method is: public iqueryable<workcellloadgraphdata> getworkcellloadgrap

Common serializer for php and java Object -

i'd serialize object java , unserialize object in php. saw different classes in java not able serialize not primitive object. by way, know can read details of language generated function 'serialize' of php? thank much bat when unserializing object in php, php needs have class definition of object . doubt you'll far if original class java class. i'd suggest go language neutral data encapsulation format json. can json_decoded stdclass object.

sql - Database management for product release -

in our company developing product. relying on tfs manage release issues using branching , merging. still have problem sql database on how track changes , send them customer. we use liquibase : liquibase open source (apache 2.0 licensed), database-independent library tracking, managing , applying database changes.

mysql - How can I simplify this Wordpress query to increase performance? -

i have several boxes in wordpress site have show selection of posts belong categories , not belong several others. using native wordpress tools result query this: select sql_calc_found_rows wp_posts.* wp_posts inner join wp_term_relationships on (wp_posts.id = wp_term_relationships.object_id) inner join wp_term_taxonomy on (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) 1=1 , wp_term_taxonomy.taxonomy = 'category' , wp_term_taxonomy.term_id in ('1', '49') , wp_posts.id not in ( select tr.object_id wp_term_relationships tr inner join wp_term_taxonomy tt on tr.term_taxonomy_id = tt.term_taxonomy_id tt.taxonomy = 'category' , tt.term_id in ('3394', '49', '794', '183') ) , wp_posts.post_type = 'post' , (wp_posts.post_status = 'publish') group wp_posts.id order wp_posts.post_date desc limit 0, 5; now quite expensive , ends in slow queries log. i'

jsp - Task scheduling for multiple tasks in java? -

i have build java clock using timer,which works fine single task alarm on next given/setted time, having problem in scheduling multiple tasks(alarms diff. times) timer, 2 times can clash each other(same times 2 different works) how synchronize between such conditions, please help.... thanks , regards alok sharma i'm not sure you're trying do, if use quartz scheduler, can resolve scheduling/synchronisation task: http://www.quartz-scheduler.org/

javascript - How can I show a div, then hide the other divs when a link is clicked? -

i right trying hide 6 divs while showing 1 of divs. i've tried javascript , in jquery, nothing seems work! click here website. i know if has css, jquery, or html. or there easier way of doing this? html: <div id="resourcelinks"> <a href="#" name="resource" id="resource1">general&nbsp;information</a><br /> <a href="#" name="resource" id="resource2">automatic&nbsp;401(k)</a><br /> <a href="#" name="resource" id="resource3">consumer&nbsp;fraud</a><br /> <a href="#" name="resource" id="resource4">direct&nbsp;deposit</a><br /> <a href="#" name="resource" id="resource5">diversity</a><br /> <a href="#" name="resource" id="resource6">women</a><br />

No audio/video streaming is possible in blackberry if memory card is not installed -

if there no memory card installed in phone browser not allow stream video or audio files if there enough memory in phone memory. example if 30mb phone memory free , try download or stream 5mb file browser not allow me do. if there memory card installed allows me stream both on phone memory , memory card. is expected behavior or else?

php - Can i retrieve array value not using loop? -

is there way retrieve array value not using loop function? have sort of array $at=array( array( array('title:','titl','s','c',$titles), array('first name:','name','i','a',2,10 ), ), try array_values sorry 1 suppose comment.

php - How do I put extra number at the end of username if duplicate -

hard explain, , let me show example. if username foo exists in mysql want php script allow foo1 then if foo1 exists too, script generate username foo2 if foo2 existed become foo3 how make that? like col. shrapnel said natural increment seems more sensible. "new folder(3)" stuff in windows first, lock table no other table write @ same time. this: $name = 'foo'; $first_name = $name; $i = 0; { //check in database here $exists = exists_in_database($name); if($exists) { $i++; $name = $first_name . $i; } }while($exists); //save $name another method select names in table starting "foo" , ending in number , finding largest number. can done in sql. the first method better use cases small risk of collision, since pattern matching may slow, if have lot of collisions latter may better.

rest - PHP Tonic Services - Using the same verb more than once in the same service -

i started looking @ tonic restful services framework , think it's nice framework. problem cannot find resources apart examples in order see possible ways of using it. i example know if use post verb more 1 time in single resource , if there sort of annotation allow me that. example jax-rs have @action annotation. i not have lot of experience rest or php need help. thank in advance. no, cannot. can route posts using variable in posts requests. make sure clean methods name security reasons... something this. /** * handle post request resource * @param request request * @return response */ function post($request) { if (isset($_post['method'])) { return $this->$method($request, $name); } } function post_one($request) { // code here } function post_two($request) { // code here } //...and on... if want check if method exists, use like if (method_exists(

c++ - Help with strange memory behavior. Looking for leaks both in my brain and in my code -

i spent last few days trying find memory leaks in program developing. first of all, tried using leak detectors. after fixing few issues, not find leaks more. however, monitoring application using perfmon.exe . performance monitor reports 'private bytes' , 'working set - private' steadily rising when app used. me, suggests program using more , more memory longer runs. internal resources seem stable however, sounds leaking me. the program loading dll @ runtime. suspect these leaks or whatever occur in library , purged when library unloaded, hence won't picked leak detectors. used both devpartner boundschecker , virtual leak detector memory leaks. both supposedly catch leaks in dlls. also, memory consumption increasing in steps , steps roughly, not exactly, coincide gui actions perform in application. if these errors in our code, should triggered every single time actions performed , not most of time . whenever confronted strangeness, begin question basic

How to generate assembly code from C++ source in Visual Studio 2010 -

i want generate assembly code c++ source code using microsoft vc++ compiler. want in command line itself. not ide. what're commands/options? i believe /fa switch for.

c# - Is there any limit on how much text asp:label control can hold? -

should use if wanna store long text? i use <asp:literal enableviewstate='false' ... apparently more lightweight <asp:label ... a literal control more light weight label.. it's meant write out text/html directly browser. label little bulkier literal, has benefits of webcontrol such styling options etc. it should noted label wrap content <span> ... </span> whereas literal not.

flex - How to decompress zlib files created with ByteArray.compress? -

i work on flex application creates compressed files , uploads them on server. files created bytearray.compress method, zlib compression. can decompress them using python api on server prefer keep files compressed there. want able download , decompress files later, winzip , winrar fail decompress them. when google zlib utility, find zlib dll library. need simple application windows (and/or linux) capable of decompressing zlib files. so, zlib compression compress data down, doesn't include file headers make "zip" file can opened using apps windows, winzip or winrar. adobe has some documents explain how read zip file , including information header. if want write zip file, use information write out header data. good luck!

c# - silverlight draw on bitmap -

image img = new bitmap(image.fromfile(file.fullname)); using (graphics g = graphics.fromimage(img)){ g.drawrectangle(pens.black, 0, 0, img.width - 2, img.height - 2); } like this how in sliverlight? use writeablebitmap class. references: rendering xaml jpeg using silverlight 3 silverlight 3.0: writeablebitmap silverlight 3's new writeable bitmap example: with writablebitmap , can draw on control or canvas , save bitmap using it's public writeablebitmap(uielement element,transform transform) constructor.

javascript - Two version of the same code returns different result -

the 2 code below same give me different result in ie8. have idea that? $('#framemain').load(function(){ var bodyheight = $(this.contentdocument).find('body').attr('scrollheight'); var bodyheight2 = document.getelementbyid('framemain').document.body.scrollheight; }); this code refer parent body, not child. document.getelementbyid('framemain').document.body.scrollheight it should this: document.getelementbyid('framemain').contentdocument.body.scrollheight;

air - Receive asynchronous events from a web application to a desktop application in Actionscript 3 -

i want build simple web 2.0 collaborative website using asp.net mvc2 or flash , want receive events web based interface desktop air application. e.g, makes comment on blog post, want information passed on desktop air application showing new comment has been made. technique receive asynchronous events? the easy way set timer request xml webservice each xxxx miliseconds. optimization tip ask if there new items load before call complete xml.

objective c - Having a hard time understanding NSBezierPath's curveToPoint: method -

Image
i'm trying grips drawing (fairly basic) shapes in cocoa. understand how create paths straight edges (duh!), when comes doing curves, can't head around inputs produce shaped curve. specifically, have no idea how controlpoint1: , controlpoint2: arguments method influence shape. i'm trying approximate shape of tab in google chrome: and code i'm using is: -(void)drawrect:(nsrect)dirtyrect { nssize size = [self bounds].size; cgfloat height = size.height; cgfloat width = size.width; nsbezierpath *path = [nsbezierpath bezierpath]; [path setlinewidth:1]; [path movetopoint:nsmakepoint(0, 0)]; [path curvetopoint:nsmakepoint(width * 0.1, height) controlpoint1:nsmakepoint(width * 0.05, height) controlpoint2:nsmakepoint(width * 0.03, height * 0.05)]; [path linetopoint:nsmakepoint(width * 0.9, height)]; [path curvetopoint:nsmakepoint(width, 0) controlpoint1:nsmakepoint(width * 0.95, height)

.net - Can I connect mysql to visual studio 2010 express visual tools -

my question express edition vs professional, should able use database connections mysql .net connector in express edition? or work in professional edition? i'm using express , i've tried latest .net connector , still doesn't show in database connections list. mysql connector/net not work in express version of microsoft studio due limitations within express products. in order use data sources based in server architecture non-"express" versions must used. connectivity microsoft's own mssql not work, aside local limited "compact" or "express" versions.

regex - Removing delimiters from a date/time string -

i want take this code: 2010-12-21 20:00:00 and make this: code: 20101221200000 this last thing tried code: #!/usr/bin/perl -w use strict; ($teststring) = '2010-12-21 20:00:00'; $result = " "; print "$teststring\n"; $teststring =~ "/(d\{4\})(d\{3\})(d\{3\})(d\{3\})(d\{3\})(d\{3\})/$result"; { print "$_\n"; print "$result\n"; print "$teststring\n"; } and produced this: code: nathan@debian:~/desktop$ ./ptest 2010-12-21 20:00:00 use of uninitialized value $_ in concatenation (.) or string @ ./ptest line 8. 2010-12-21 20:00:00 nathan@debian:~/desktop$ -thanks first, here problem code: $teststring =~ "/(d\{4\})(d\{3\})(d\{3\})(d\{3\})(d\{3\})(d\{3\})/$result"; you want use =~ substitution operator s/// . is, right hand side should not plain string, s/pattern/replacement/ . in pattern part, \d denote digit. however, \d includes sorts characters i

python - Directory Listing based on time -

this question has answer here: how directory listing sorted creation date in python? 11 answers how list files in directory based on timestamp? os.listdir() lists in arbitrary order. is there build-in function list based on timestamp? or order? you call stat() on each of files , sort 1 of timestamps, perhaps using key function returns file's timestamp. import os def sorted_ls(path): mtime = lambda f: os.stat(os.path.join(path, f)).st_mtime return list(sorted(os.listdir(path), key=mtime)) print(sorted_ls('documents'))

How can my WPF application (w/ MVVM, Prism) interact with a monolithic MFC application? -

i'm developing wpf front end (using mvvm , prism) existing mfc application. application not going changed monolithic , lacks documentation of kind. there technologies can either bring these 2 platforms same memory space (best option) or allow them communicate in synchronously (as mfc application no means thread safe)? maintain stability, need wpf executable. i've tried attaching dll mfc application, results in extreme instability. one option have directly host mfc in wpf, or embed wpf in mfc app outlined on wpf , win32 interoperation msdn article. specifically, check out 2 walkthroughs mentioned @ top of article. i found embedding wpf in mfc code simpler rehosting mfc application in wpf. hosting wpf in mfc matter of correctly using hwndsource class (if you're unafraid of using managed c++ can create nice interop layer , avoid /clr flag in mfc project altogether.) hosting mfc application within wpf application trickier if trying rehost mdi applicatio

design - How to model multiple inheritance objects in Java -

i've got following problem in little soccer manager game i'm writing. i've got classes person, player, coach, manager. person base class of other ones. problem player can coach and/or manager. adding more roles (e.g. groundkeeper) i'll more , more complex - so, how can implement efficiently? isn't there pattern that? don't model role type of person. person should have collection of roles public enum role { player, coach, ref } public class player { private final string name; private collection<role> roles = new arraylist<role>(); public player(string name) { this.name = name; } public void addrole(role role) { this.roles.add(role); } }

javascript - Avoid loading marker with the same latitude and longitude on google map -

i marker through ajax map move. however, there method avoid loading marker same latitude , longitude on google map? let once marker latitude , longitude loaded, not added second time when map move location. thank you. keep array of markers , @ before loading new markers, ensure haven't been loaded. each new marker added, append array.

C# Byte[] Encryption -

i have byte[] field file contents need encrypt. nothing special or fancy, enough make sure next person gets won't able decode without effort. use encryption comes .net framework 4.0 not need make file bigger is. i thought reversing array or adding few bytes end...? if can avoid making array bigger great. any suggestions? thanks! does addition of 1-16 bytes hurt? aes pad default using below method: private static void encryptthendecrypt() { byte[] message; // fill bytes byte[] encmessage; // encrypted bytes byte[] decmessage; // decrypted bytes - s/b same message byte[] key; byte[] iv; using (var rijndael = new rijndaelmanaged()) { rijndael.generatekey(); rijndael.generateiv(); key = rijndael.key; iv = rijndael.iv; encmessage = encryptbytes(rijndael, message); } using (var rijndael = new rijndaelmanaged()) {