Posts

Showing posts from February, 2015

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.

api - MediaWiki: search for a sub-category in category (case-insensitive!) -

i'm trying make search composer in international music score library project (imslp.org). imslp's wiki have category composers (http://imslp.org/index.php?title=category:composers) 4665 sub-categories. 1 sub-category - 1 composer. is possible make search sub-category in category (case-insencetive!) i'd read mediawiki's api , make list-request: http://imslp.org/api.php?action=query&list=categorymembers&cmtitle=category:composers&cmlimit=100 want, how implement server-side search on result (or make other conditions in request). there nothing wrong using api server-side. try using this: $api = new apimain(new fauxrequest($params)); $api->execute(); $res = $api->getresultdata(); fauxrequest takes array query parameters.

Question About ASP.NET MVC vs. ASP.NET Web Froms -

i'm junior programmer, not concept of mvc! method of coding seperating application design 3 layers: presentation layer business layer data access layer i find practical junior developer or @ least me, not point of mvc since believe mvc tries separate logic ui. right? i'm confused can please give advice! any appreciated... i decided have book me have better idea on code design: http://www.amazon.com/professional-asp-net-design-patterns-millett/dp/0470292784/ref=sr_1_1?ie=utf8&qid=1292836936&sr=8-1 note: decided start learning tdd. question: breaking code design 3 layers (presentation, dal , business) meets mvc concept? i quite late 'convert' mvc, after having been both classic asp , webforms developer on 10 years. however, 18 months ago, project came along our management team decided self contained project trial mvc on. tasked managing project. i'll admit sceptical had large collaterol of components built webforms our own 'mi

c# - how can i call a method using button -

i have simple question:i have example public int x(int a,int b) { } now how can call when click button?i mean when click button,x() call , work,thanks helps private void button1_click(object sender, eventargs e) { int retval = x(1,2); } or if part of class public class foo { public int x(int a, int b) { return + b; } } then like private void button1_click(object sender, eventargs e) { int retval = new foo().x(1, 2); //or foo foo = new foo(); int retval2 = foo.x(1, 2); } or if static member public class foo { public static int x(int a, int b) { return + b; } } then like private void button1_click(object sender, eventargs e) { int retval = foo.x(1, 2); }

rails will_paginate with JQuery UI Tabs -

i know if possible add pagination will_paginate each of tabs in jquery ui tabs. for exemple, have 2 tabs, 1 ten element , 1 thirty. possible add pagination each ten elements in order have first tab without pagination , second 3 pages? thank you yes possible. will_paginate generate correct urls each set of resources.

sql server - MSSQL - Define a column name in SELECT statement then use that in WHERE clause -

is there way use defined column name in select statement clause? here t-sql codes, select convert(datetime,( case when operator = 't' (substring(senddate,7,4)+'-'+substring(senddate,4,2)+'-'+ substring(senddate,1,2) + substring(senddate,11,9)) else recivedsms.senddate end)) defineddate datepart(wk, defineddate) = 52 yours affectionately , thank helps, now. edited part of posted create table #temp ( datefield datetime, numberfield varchar(10), sender varchar(255) ) insert #temp select distinct( convert(datetime, ( case when operator = 't' ( substring( senddate, 7, 4 ) + '-' + substring( senddate, 4, 2 ) + '-' + substring( senddate, 1, 2 ) + substring( senddate, 11, 9 ) ) else senddate end))) ta

c - Sending file descriptor over UNIX domain socket, and select() -

i'm using unix domain socket transfer file descriptor process. works fine, when first try see if socket writeable using select(), sendmsg() call fails bad file descriptor error. the sendmsg() function work fine in combination select() if don't add file descriptor info msghdr struct, conflict seems between select() , transferring file descriptors. i couldn't find info on in man pages select(), recvmsg(), or other. since needs become server hands out file descriptors multiple processes, i'd still able use select(). is there can make work, or know of alternative solutions? platform ubuntu 10.4. this code initializes structures: struct cmsghdr_fd : public cmsghdr { int fd; }; int sendfd(int sock, int fd) { struct msghdr hdr; struct iovec data; struct cmsghdr_fd msgdata; char dummy = '*'; data.iov_base = &dummy; data.iov_len = sizeof(dummy); hdr.msg_name = null; hdr.msg_namelen = 0; hdr.msg_iov = &data; hdr.msg_iovle

MinGW compiler suite -

i installing mingw compiler suite in directory c:\mingw , set path environment. don't know uses in project, , want compile program gcc compiler, don't know steps. how compile program gcc? just use this: mingw-downloader

HTML form - PHP not inserting into Database correctly -

i'm tring make form work. similar fillin now: question, text, tags. fine, this when print form function imprimir_formulario_pregunta(){ $html = '<form id="pregunta" name ="pregunta" method="post" action="preguntas.php">'; $html .= '<h2>pregunta</h2>'; $html .= '<input name="q" id="q" type="text" value=" "></input>'; $html .= '<h2>explica tu duda</h2>'; $html .= '<textarea name="texto" id="texto" / ></textarea>'; $html .= '<h2>etiquetas (separadas por comas)</h2>'; $html .= '<input name="tags" id="tags"/>'; $html .= '<input name="responde_a" style="display:none;" id="responde_a" value="0"/>'; $html .= '<button

Turn off WPF default UI animations (checkbox etc.) -

i intending use default aero theme unhappy fade-in happens when checking checkbox of other 'flashy' effects button pulses. is there way turn off these effects / animations without re-templating controls? thank kindly. the short answer no. these default effects used when system theme aero (i.e windows 7 , vista). you have perform sort of re-styling or re-templating remove elements include these animations (i.e. controls in presentation.aero). you explicitly load different theme, such luna, royale, or classic. but, you'd lose aero look. blog explains how explicit load aero theme, can replace 1 of others.

php - How to join two tables in Codeigniter -

i try join 2 tables , output result: in model: $this->db->select('*'); $this->db->from('news'); $this->db->join('authors', 'authors.id = news.author_id'); in view files: foreach($item $row): echo $row->id; endforeach; when run code above, output id column authors table. question how echo id column news table? both news , author tables have column named id . try echo $row->author_id it seems field want in news table author_id instead of id . edit otherwise can use as sql keyword in select statement give different name field. $this->db->select('*, news.id my_news_id'); and do, echo $row->my_news_id

php - Deploying Symfony 1.4 project -

i have developed project written using symfony 1.4 installed through pear. in previous symfony versions there used freeze , unfreeze functions copy necessary files, in versions these functions missing. question - fastest way deploy project on shared hosting? in config/projectconfiguration.class.php change require_once statement sfcoreautoload class. make search symfony in lib/vendor/symfony : require_once dirname(__file__) . '/../lib/vendor/symfony/lib/autoload/sfcoreautoload.class.php'; now can 2 things: copy whole symfony lib lib/vendor/symfony dir. way have symfony project. drawback have copy while sending files server. create lib/vendor/symfony symbolic link pointing symfony lib. advantage don't have copy whole framework time. drawback still have put symfony in same location on dev , production servers. however, symbolic link might relative project (i.e. 1 level up).

c# - Updating LINQ to SQL but the query i have is from a join? Can't update using query that uses a join? -

i have query returns iqueryable, query consists of join. end user needs able update fields. rememeber fields don't come 1 table result of 2 joins. hence how use data returned query , change , update database? do need futher 2 select queries obviosly return linq2sql class can change values in class , update database? i little confused best way around problem. when want alter data, need work classes linq sql generated you. way, linq sql knows changed (change tracking) , how update corresponding database record. in other words, change on anonymous object or custom object won't noticed. join however, has nothing it.

pluralize - Why does Rails use plurals for new and create? -

i understand why rails index method use plural form of resource - we're showing projects , example. and understand why show method use singular form - want see 1 project , particular id. but don't understand why new , create use plural. there way create more 1 project @ time? there other reasoning using plural here explain? new , create aren't plural, in way think rest. instead, think like: whatever.com base domain, , whatever.com/books means have collection of resources each named book. collection named books. so, when want create new book, asking collection information needed create new book. becomes /books/new when create book, posting information /books . http verb post, when post collection, execute create action. this looks good starting point on rest.

actionscript 3 - Use Flash Event System or build own Observer Design Pattern? -

in cookbook advocates build own observer design pattern: http://cookbooks.adobe.com/post_using_observer_pattern_instead_of_events-18232.html is faster performance ? yes dispatching event slow, if performance goal can go own event system or if don't want reinvent wheel take @ as3 signals library robert penner.

Is there a full HTML/Javascript online search engine? -

i'm looking search engine index html , javascript code, , not rendering. use case: specific hardcoded javascript parameter used somewhere in ~80000 pages site work on. need find page specific parameter. much appreciated. edit: context: don't have direct access code. parameter in question used configure info send adobe's omniture (into weird hits). edit: maybe there no such search engine. i'll keep question open... as far know, there isn't online search engine that. closest can google code search indexes public source code. might able make use of if host code public repository on services such github , google code , sourceforge , etc. if private project you're working on, should have access source code, no? if so, @spiny norman mentioned, can use grep . for large source base, might better off using ack . if have code in svn/git, svnquery or git grep .

Is python is a good choice as language used to implementing my first 3D model? -

i c/c /java programmer, lately have started learn python. moreover have 3d graphics on studies. have create 3d model of apartment, dynamic camera. wondering if idea merge 2 issues, writing 3d model in python. however said, python beginner, don't know possibilities, python can give me in area. libraries/engine best start? you can checkout pyglet , higher-level library using opengl.

jquery - how to replace the text with desired text in a para -

i have following code.. in trying find particular text , replace desired one.. working fine if string in same case.. if give capitals (like.. the) not giving out put.. solution this.. can use regular expressions in one..? please me <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <title> new document </title> <script type="text/javascript" src="jquery-1.4.2.min.js"></script> <script> $(document).ready(function(){ $('#replace').click(function(){ var oldstr=$('#inputstring').val(); var newstr=$('#newstring').val(); var para=$('#para').html(); var x=para.replace(oldstr,newstr); $('#para').empty().html(x); }) }) </script> </head> <body> enter string here:<input type="text" id="inputstring"><br> enter new string here:<input type=&q

c# - rails escape_javascript in .net -

for rails developer please check last paragraph. is there equivalent of escape_javascript in rails .net .net mvc2? going return javascript needs escaped since getting code view using renderpartialviewtostring http://craftycodeblog.com/2010/05/15/asp-net-mvc-render-partial-view-to-string/ you can see escape_javascript here why escape_javascript before rendering partial? if not familiar functionality. rails developers: feels function should easy implement or port rails can explain more escaping qoutes? if go here, , click on show source link, can see source method. regex.replace() call.

android - Manual Route Adjustment Using Google Maps API -

in google maps web, possible manually adjust automatically created route dragging point on path other road in view. android app not have feature built-in. possible manually adjust routes in application uses com.google.android.maps api? com.google.android.maps not offer routing @ all, let alone automated routing, let alone manual adjustments automated routing. if drawing own routes using overlay, can respond touch events in overlay , adjust route wish.

SharePoint site hierarchy for company intranet - multiple sites or sub-sites with one root? -

i'm manager @ mid-size manufacturing company. getting our feet wet sharepoint - far we're got 1 blog in production use> it's ceo's. we have use cases couple of list-based "applications" simple workflow implemented 1 of our developers. want give our users (at least more tech-savvy ones) ability create , work own departmental sites. we're concerned, however, might starting out of control if it's adopted (which thing). since don't understand architectural trade-offs, end massive amounts of user data in structure bites down road. our biggest question whether have multiple sites each use vs. single root site else descends. multiple sites give flexibility make changes or develop new features without creating problems users. however, multiple sites might harder back-up, search, , maintain user profiles/security. single massive site seems reverse cost/benefits. i'd appreciate insight on 1 vs. many trade-offs, or links resources dis

vb.net - Raising events in a class library exposed to COM -

i'm trying write wrapper service, used existing vb6 project. i've got of basic framework working, except 1 important aspect: can reference wrapper in vb6 project , subs/function calls etc. work expected, events not. events visible in vb6 app, never fire. vb.net code: public event action_response(byval status string) public function testevent() raiseevent action_response("test done") return "done" end function vb6 code: dim withevents my_wrapper wrapper_class private sub cmdtest_click() set my_wrapper = new wrapper_class debug.print my_wrapper.testevent() end sub private sub my_wrapper_action_response(byval status string) debug.print status set my_wrapper = nothing end sub so, cmdtest button code prints 'done' expected, action_response event doesn't fire. there else need event fire? its write in comment, i'll make answer.... first, identify .net class want expose com. i'll pick class cal

Android listview inside tab layout inside dialog can't get scroll bars to show up -

i have custom dialog class extends dialog. inside have tab layout 2 tabs. in each tab have list view. works can't scroll bars show up. here xml: <?xml version="1.0" encoding="utf-8"?> <tabhost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tabhost01" android:layout_width="300dp" android:layout_height="300dp"> <linearlayout android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content"> <tabwidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content"/> <framelayout android:id="@android:id/tabcontent" android:layout_width="wrap_content" android:layout_height="wrap_content"> <listview android:i

ajax - .NET Billboard Control -

i still can't seem work. if else has ideas appreciate it. 2 websites controls trying duplicate mtv.com , nba.com. couldn't jcarousel or adrotator have 4 images rotate. 1 large image , 3 small images. if has ideas please let me know. hello, does know can find billboard control? i'm not sure it's called i'm going call billboard control. examples of these @ 3 below websites. i'm talking anywhere 3 5 images or html files rotate every couple of seconds preview of these images/html files side or below. looking can use c# .net. appreciated. espn.go.com mtv.com nba.com thanks asp.net webforms comes control. called adrotator .

Design for retrievable information and database access -

i in following situation. make real world case put things clear. suppose have model cube in 3d space, , cube has specific material: object of type cube contains set of information spatial position, , type of material, string. cube passed around many algorithms , classes, can perform tasks, such rendering cube. for happen, these algorithms , classes require additional info object, namely, material properties such reflectiveness. these info not specific object, can obtained means of current object data (namely, material cube made of). technically, have database of materials, can resolve string declaration of material specific cube detailed info specific material. renderer need these info, in following possible situations: i pass cube and database renderer, , let renderer query database, info material, , render cube i make database global object, can queried regardless of position in code, saving need pass database around, creating implicit dependency against database i data

c - Is there an equivalent to the GNU linker "--just-symbols" option for non-GNU linkers? -

-r filename --just-symbols=filename read symbol names , addresses filename , not relocate or include in output. allows output file refer symbolically absolute locations of memory defined in other programs. may use option more once. for example, on mac, ld -r libsomething.a or gcc -wl,-r,libsomething.a doesn't work. since you're talking "your mac", assume talking os x operating systems. on unix-based systems linker " ld " (with -r option) used of times (see also: elf ). in contrast os x systems use mach-o binary format , tool dyld linking. os x doesn't provide same features libraries unix does. try otool -l on binary see libraries expected. may want try setting dyld_library_path ( man dyld ) binaries keep in mind security risk (this used inject code ld_library_path on unix-systems).

c - Uses of static variables inside functions -

i have been writing c code many years, came accross feature have never used: static variable inside function. therefore, wondering ways have used feature , right design decision. e.g. int count(){ static int n; n = n + 1; return n; } is bad design decision. why? because later might want decrement count involve changing function parameters, changing calling code, ... hopefully clear enough, thanks! void first_call() { static int n = 0; if(!n) { /* stuff here on first call */ n++; } /* other stuff here */ }

oracle - sql restricted count query -

i'm not how structure sql query return number of rows column equals values. for instance, in table mytable , how can return count of rows mycolumn = "xyz" , mycolumn = "abc" ? possible single query? to clarify, there 10 rows mycolumn = "xyx" , 7 rows mycolumn = "abc" , query return like: firstcountresult: 10 secondcountresult: 7 how about?: select count(*), mycolumn mytable mycolumn in ('xyz', 'abc') group mycolumn this approach works other aggregate functions min, max, avg, sum... aggregate result per grouped column's value versus across rows. --min mydate per mycolumn value select min(mydate), mycolumn mytable mycolumn in ('xyz', 'abc') group mycolumn --sum of mynumericcol per mycolumn value select sum(mynumericcol), mycolumn mytable mycolumn in ('xyz', 'abc') group mycolumn

internationalization - Qt linguist CODECFORTR option in Visual Studio -

i developing qt application using visual studio , qt visual studio add-in. using non-latin1 characters in source code, need specify codecfortr in .pro file qtlinguist display correctly. vs add-in doesn't create .pro file, provided "lupdate files" , "lrelease file" options in project context menu. there way pass codecfortr option lupdate tool using vs add-in? try this: #include <qapplication> #include <qtgui> #include <qtextcodec> int main(int argc, char *argv[]){ qapplication a(argc, argv); qtextcodec::setcodecforlocale( qtextcodec::codecforname("utf-8") ); qtextcodec::setcodecfortr( qtextcodec::codecforname("utf-8") ); qtextcodec::setcodecforcstrings ( qtextcodec::codecforname("utf-8") ); ... ... return a.exec(); } you may need change utf-8 encoding u using

Links being acted on -- style in CSS or using JavaScript? -

should use a:hover, a:active, a:visited , a:link, or similar javascript things (tags??) instead? highly dependent on you're trying do. if a:active/:visited/:link/:hover provide sufficient styling control, use work across browsers or without javascript enabled. if you're trying fancy can't accomplished css, use javascript. it's common mix 2 techniques... use css parts can , use javascript else.

c# - How to correctly update entities in EF4 using POCO and custom ObjectContext? -

using technique described here have simple poco ef4 model , running. saving new , deleting straightforward (using addobject() , deleteobject() respectively). way of updating objects have found retrieve stored version of object , manually update properties new values object being saved. surely there better way? my objectcontext disconnected - in otherwords, use new objectcontext instance each operation on model. thanks. use stub technique : public void updateorder(order o) { var stub = new order { id = o.orderid }; // create stub entitykey ctx.orders.attach(stub); // attach stub graph ctx.applycurrentvalues("orders", o); // override stub values. ctx.savechanges(); } if entity in graph, osm exception (entity key exists). i counteract checking if object exists in graph first (trygetobjectstateentry) , attaching if doesn't.

javascript - About ![CDATA[, what is it? -

possible duplicate: what meaning of cdata what is, , when used ![cdata[ string/variable/constant? (i don't know it) it way escape large sections of text in xml documents. from wikipedia : in xml document or external parsed entity, cdata section section of element content marked parser interpret character data, not markup. by way, <![cdata[]]> , not ![cdata[]] .

php - create empty spreadsheet in google docs -

i want create empty spreadsheet google docs api error: not convert document. $xml = "--end_of_part\r\n". "content-type: application/atom+xml;\r\n\r\n". "<?xml version='1.0' encoding='utf-8'?> <entry xmlns=\"http://www.w3.org/2005/atom\" xmlns:docs=\"http://schemas.google.com/docs/2007\"> <category scheme=\"http://schemas.google.com/g/2005#kind\" term=\"http://schemas.google.com/docs/2007#spreadsheet\"/> <title>".$name."</title> </entry>\r\n". "--end_of_part\r\n". "content-type: text/csv;\r\n\r\n". "--end_of_part--\r\n"; this xml sent server of google post param convert=true got error: not convert document. when use mime-type 'application/vnd.oasis.opendocument.spreadsheet' instead of 'text/csv' , not add

css - How to force a li item to be 100% of the parent container's width in IE 7? -

i'm applying background color list items. in ie7, child list items not being rendered full width of parent ul item. instead, appears act inline elements (their width extends boundary of text makes content), though i've set child li elements display:block; it presents correctly in browsers i've tested except ie7. i'm thinking might specific workaround browser, yes? <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <title> new document </title> <style type="text/css"> .menu.top {height:30px; overflow:hidden; color:#f9f9f9; text-transform:uppercase; font-size:.85em;margin:101px 0 20px 0; padding-left:30px; border-radius: 15px; -moz-border-radius:15px;background:blue;} /*category flyout menus */ .menu.top.cat {overflow:visible; } .menu.top ul {margin:0; padding:0;white-space:nowrap;background:blue; position: relative; list-style

repository - Using Mercurial when I've done a complete rewrite -

this repository: https://bitbucket.org/sergiotapia/sharpdic basically, i've rewritten entire library. doesn't resemble original @ all. command can run erase/neglect existing code base , replace newer code version? i've done hg init on folder on local disc (it has newer code), have delete before trying upload? thanks. just go revision 0 ( hg null ), commit (creates new branch), , close old branch. that's if not replacing repo altogether. i assume new files not yet in repo directory. make backup first! hg tip -c hg commit -m 'old code branch' --close-branch hg null -c you'll have empty reporsitory directoy, starting @ revision 0. copy new files (don't copy .hg folder new file directory). hg addremove hg commit -m 'new code branch' that should trick. did mention backup files , repo first? ;-) another option force push of new repo onto remote repo, you'll still need close old branch after doing in order have 1

java - Webdriver firefox-bin uses excessive amount of CPU -

i running single test (firefoxdriver)which visits links on given domain. os: ubuntu 9.10 memory: 4gb hd: 500gb 10 mbp/s line observing following via command top 11001 hudson 20 0 508m 108m 28m s 64 2.8 2:31.58 firefox-bin 10937 hudson 20 0 1277m 73m 9772 s 6 1.8 0:21.93 java 10929 hudson 20 0 43820 10m 3440 s 3 0.3 0:06.25 xvnc 64% cpu consumption via firefox-bin. anyway can reduce ? on 3ghz machine, see firefox using in range 25-40% cpu when running @ full blast through site. remember firefox execution environment code. page efficiency corrolates cpu usage on host. standard tricks optimizing javascript, css , page rendering apply here, not webdriver such, although can expect baseline reasonably efficient pages around 30%

linux - Cron compress files -

i introduce cron tak 'gzip' files following rule: locate files in folder name '/log' (can located anywhere in filesystem) and gzip files, older 2 days, have ' ./log ' in file name handle i have written script below - not work - close? required make work? thanks. /usr/bin/find ./logs -mtime +2 -name "*.log*"|xargs gzip in crontab, call: /usr/sbin/logrotate -s ~/.logrotate/status ~/.logrotate/logrotate.conf in ~/.logrotate/logrotate.conf: # rotate log files weekly weekly # keep 4 weeks worth of backlogs rotate 4 ## compression # gzip(1) #compresscmd /usr/bin/gzip #compressoptions -9 #uncompresscmd /usr/bin/gunzip #compressext .gz # xz(1) compresscmd /usr/bin/xz uncompresscmd /usr/bin/xzdec compressext .xz /home/h3xx/.log/*.log /home/h3xx/.log/jack/*.log { # copy , truncate original (for always-open file handles # [read: tail -f]) copytruncate # enable compression compress } /home/h3xx/.usage/*.db {

.net 4.0 - How to have n variables in C# -

imagine code for (int iday = 1; iday <= total_days; iday++) { question = checkstring(s.challenge_1_q); answer = checkstringa(s.challenge_1_a); // more here } but have challenge_1_q challenge_24_q , challenge_1_a challenge_24_a what best option have dynamic variables today it's 24, "tomorrow" 18. is use of dynamic proper way? or need have switch , forget dynamism ? create class called questionanswer, store list on s. accessing code this: question = checkstring(s.questionanswers[i].question); answer = checkstringa(s.questionanswers[i].answer); the questionanswer class: public class questionanswer { public string question{get; set;} public string answer{get; set;} } and definition on existing class: public list<questionanswer> questionanswers = new list<questionanswer>(); instead of having dozens of variables, add dozens of items list: questionanswer qa = new questionanswer(); qa.question = "what l

export - how can I move my Qt project to another PC -

i working on qt gui project in pc qt creator. want shift project new pc installed qt creator. can know how can create single package of current qt project work export pc. i tried copy whole project folder din't work. resource files din't came , getting lot of compilation errors. there no such option export/import project in qtcreator, however... you can copy project folder of application on new machine if have identical configuration: qtcreator , qt library installed in same path on old machine. project folder copied same path on other machine. the reason simple: application.pro.user file contains absolute paths. on other hand, can copy folder new path. delete application.pro.user file. , open application.pro in qtcreator - create new local project. qtcreator ask qt version want use. if have problem resource files, ensure not use absolute paths. open resources.qrc file in text editor , see paths have there.

.htaccess - Adding www, trailing slash to URL using Apache with clean urls -

i using .htaccess file send requests index.php so: <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> i want have requests without www redirected www.mydomain.com , importantly add trailing slash urls don't have one. every time try end 500 error. know how this? thanks help. rewritecond %{http_host} ^www\.(.*)$ [nc] rewriterule ^(.*)$ http://%1/$1 [r=301,l] there webpage specially made reason: http://no-www.org/ cheers simon

osx - How to Set default-character-set to utf8 by mysql 5.58 in mac os 10.6.5 -

i copy my.cnf etc folder , [client] [mysqld] set ault-character-set = utf8 server not start ,in mac os 10.6.5 ,how set ddefault-character-set utf8 mysql 5.58 ? [client] default-character-set=charset_name source : http://dev.mysql.com/doc/refman/5.0/en/charset-configuration.html more on charset configuration - http://dev.mysql.com/doc/refman/5.0/en/mysql-command-options.html#option_mysql_default-character-set

css - Preventing subelement from exceeding parent's height? -

given code: .yourheadercontainer {background-color:#eeeeee; line-height:34px; height:34px;} .yourheadercontainer .challengesomeone {float:right; margin-right:10px; font-size:12px; font-weight:bold; padding:0px 0px 0px 0px;} is there way can prevent child element exceeding line height (or height) of parent container? do overflow:hidden on parent (overflow-y:hidden should work too).

import - python __import__ from same folder fails -

i have directory structure so: |- project |- commands.py |- modules | |- __init__.py | |- base.py | \- build.py \- etc.... i have following code in __init__.py commands = [] hooks = [] def load_modules(): """ dynamically loads commands /modules subdirectory """ path = "\\".join(os.path.abspath(__file__).split("\\")[:-1]) modules = [f f in os.listdir(path) if f.endswith(".py") , f != "__init__.py"] print modules file in modules: try: module = __import__(file.split(".")[0]) print module obj_name in dir(module): try: potential_class = getattr(module, obj_name) if isinstance(potential_class, command): #init command instance , place in list commands.append(potential_class(serverprops)) if isinstance(poten

Non-Lazy Static Initialization Block in C# -

i need run code register type factory pattern. in java static initialization block or in c++ static constructor. how do in c#? static constructor gets run lazily , since type never referred in code, never gets registered. edit: tried test see registration code work. doesn't seem working though. using system; using system.collections.generic; using system.linq; using system.text; [assembly: assemblytest.registertofactory("hello, world!")] namespace assemblytest { [attributeusage(attributetargets.assembly, inherited = false, allowmultiple = true)] sealed class registertofactoryattribute : attribute { public registertofactoryattribute(string name) { console.writeline("registered {0}", name); } } class program { static void main(string[] args) { } } } nothing gets printed. how in constructor assembly level attribute ? example: [attributeusage(attribute

iphone - zooming from a particular point -

i using code zoom particular point cgpoint getcenterpointforrect(cgrect inrect) { cgrect screenrect = [[uiscreen mainscreen] bounds]; return cgpointmake((screenrect.size.height-inrect.origin.x)/2,(screenrect.size.width-inrect.origin.y)/2); } -(void) startanimation { cgpoint centerpoint = getcenterpointforrect(self.view.frame); self.view.transform = cgaffinetransformmaketranslation(centerpoint.x, centerpoint.y); self.view.transform = cgaffinetransformscale( self.view.transform , 0.001, 0.001); [uiview beginanimations:nil context:nil]; [uiview setanimationduration:ktransitionduration]; self.view.transform = cgaffinetransformidentity; [uiview commitanimations]; } its not working. correct way zooming particular point. i think that, if i've diagnosed problem correctly, you're getting scaling animation view starts tiny , @ point, scales , moves centre of screen want, point starts @ incorrect? first of all, views scale around cen

c# - var in class gives error -

possible duplicate: using var outside of method class { string x; } // proper class { var x; } // improper (gives error) why it, cant have var type variable declare in class , can done in order achieve or alternative ? in function/method, can declare var type variable,then why can't, in class ? thanks. // method variable var x; is never valid - inside method; need immediate initialization infer type: // method variable var x = "abc"; // string as why isn't available fields field-initializer: simply, spec says so. why spec says debate... check annotated spec , suspicion more necessary method variables, logic more complex (re linq etc). also, often used anonymous types (that being necessity existence); anonymous types can't exposed on public api... have confusing: private var foo = new { x = 123, y = "abc"}; // valid public var bar = new { x = 123, y = "abc"}; // invalid so in i'm happy current

android - How could I make the SurfaceView and Button have a different orientation in a Activity -

i hava simple program video recording . use surfaceview show preview screen. , want put buttons on screen. i put component mentioned above xml file "ipcam.xml" i use mediarecorder , surfaceview , surfaceholder complete program because preview screen not orientate correctly when rotate phone. use "setrequestedorientation(activityinfo.screen_orientation_landscape);" , button in program in landscape direction . not auto change direction when rotate phone , preview ok!! so there anyway solve problem. thank in advance. you can see picture , put phone in vertical direction preview screen seems ok button in horizontal direction , don't want it. https://newslab.csie.ntu.edu.tw/~poc7667/123.png try this: <activity android:name=".myactivity" android:label="@string/app_title" android:screenorientation="landscape" android:configchanges="keyboardhidden|orientation"> </activity>

windows - Any reason I shoudn't add GUID validation to my Visual C++ program? -

in order make visual c++ program more robust i'm tempted insert checks guid variables contain valid version 4 guids (and not left uninitialized): guid guid; uuidcreate( &guid ); // many lines of code later... // following assert should not fire valid version 4 guids int data3 = guid.data3; assert( ( data3 >> 12 ) == 4 ); i'm sure guids either come within uuidcreate() function or uninitialized variables (and latter i'd diagnose checks). concern microsoft change guid implementation in future versions of windows. what other factors should consider decide whether such checks won't hurt? how guid implementation changes on future versions of windows? my concern microsoft change guid implementation in future versions of windows. deal it, if happens. no, seriously, worry implementation of integer , microsoft decide switch .net datatypes , make integer system-wide 4-byte value. worry other things, if implementations changing, you'll h

c# - WPF/MVVM - how to handle double-click on TreeViewItems in the ViewModel? -

Image
(note - re-post first question got posted under wrong headline: here sorry!) i have standard wpf treeview , have bound items view model classes. i wish handle behaviour when items double-clicked (opening documents visual-studio-style). i can event-handler fire in control housing treeview (xaml shown), how bind specific behaviour on view model classes - e.g. projectviewmodel? preferable bound icommand-implementer, used elsewhere... <treeview itemssource="{binding projects}" mousedoubleclick="treeview_mousedoubleclick"> <treeview.itemcontainerstyle> <!-- style binds treeviewitem treeviewitemviewmodel. --> <style targettype="{x:type treeviewitem}"> <setter property="isexpanded" value="{binding isexpanded, mode=twoway}" /> <setter property="isselected" value="{binding isselected, mode=twoway}" /> <setter proper

math - optimal algorithm if line intersects convex polygon -

i know if there faster algorithm o(n) detecting if line intersects convex polygon. know algorithm when check every edge of polygon if intersects line , if number of intersections odd or even, looking if there exists faster example in o (log n) complexity. thanks lhf's answer close correct. here version should fix problem his. let polygon have vertices v0, v1, ..., vn in counterclockwise order. let points x0 , x1 on line. note 2 things: first, finding intersection of 2 lines (and determining existence) can done in constant time. second, determining if point left or right of line can done in constant time. we follow same basic idea of lhf o(log n) algorithm. base cases when polygon has 2 or 3 vertices. these can both handled in constant time. determine if line (v0,v(n/2)) intersects line (x0,x1). case 1: not intersect. in case line interested in either left or right of line splitting polygon, , can recurse half of polygon. specifically, if x0 left of (v0,v(

javascript - jQuery browser detection? -

is there way detect if user's browser internet explorer using jquery? i have issue png graphics using ie , want swap them gif's if user viewing site ie. you can using $.browser , yes, it's bad idea use browser detection: if($.browser.msie) { /* ie */ } a better option instance $.support feature detection, this: if(!$.support.opacity) { /* ie 6-8 */ } $.support.opacity false in browsers don't support opacity in styling (though ie 7-8 handle transparent pngs file, still isn't ideal, depending on you're after...personally think you'd giving ie 7/8 users sub-optimal experience). what should really target ie6 doesn't support transparent pngs (without alpha filter), this: <!--[if ie 6]> <link rel="stylesheet" type="text/css" href="ie6imagestyles.css"> <![endif]-->

Querying Amazon's Simple DB using boto -

i must doing wrong, can't find on issue google. i'm using boto access sdb on amazon web services. can create new table, add items, , iterate on items in table, can't figure out how query them. "select" method there, "query" isn't. according documentation here: http://boto.s3.amazonaws.com/ref/sdb.html#module-boto.sdb.domain . it's possible use pythonic method query sdb, method doesn't exist me! here small snippet of code might describe problem: >>>domain = conn.get_domain('testtable') >>> domain.select() <boto.sdb.queryresultset.selectresultset object @ 0xb71bb2ac> >>> domain.query() traceback (most recent call last): file "<stdin>", line 1, in <module> attributeerror: domain instance has no attribute 'query' has method been removed reason? i'm no expert in crafting queries, pointing me additional documentation regarding using select method great!

validation - GWT java URL Validator -

does knows function validate if url valid or not purely in gwt java without using jsni i using 1 (making use of regular expressions): private regexp urlvalidator; private regexp urlplustldvalidator; public boolean isvalidurl(string url, boolean topleveldomainrequired) { if (urlvalidator == null || urlplustldvalidator == null) { urlvalidator = regexp.compile("^((ftp|http|https)://[\\w@.\\-\\_]+(:\\d{1,5})?(/[\\w#!:.?+=&%@!\\_\\-/]+)*){1}$"); urlplustldvalidator = regexp.compile("^((ftp|http|https)://[\\w@.\\-\\_]+\\.[a-za-z]{2,}(:\\d{1,5})?(/[\\w#!:.?+=&%@!\\_\\-/]+)*){1}$"); } return (topleveldomainrequired ? urlplustldvalidator : urlvalidator).exec(url) != null; }

objective c - Animating the drawing of a line programtaically using Quartz 2d on IOS -

i'm trying draw animated growing line using quartz 2d, adding points existing line, gradually on time. started drawing new line, in drawrect method of uiview, obtaining cgcontextref, setting draw properties, , moving first point (0,0). cgcontextref context= uigraphicsgetcurrentcontext(); cgcontextsetstrokecolorwithcolor(context,[uicolor bluecolor].cgcolor); cgcontextsetlinewidth(context, 2); cgcontextmovetopoint(context,0,0); later, in next drawrect call, tried extending line, again, obtaining cgcontextref, , adding new point it. gcontextref context= uigraphicsgetcurrentcontext(); cgcontextaddlinetopoint(context,x,y); but seems current cgcontextref doesn't have record of previous cgcontextmovetopoint command last drawrect call, therefore doesn't have reference started drawing line. am doing wrong here? there way refering drawn line? you need treat each call drawrect if starting scratch. if asked update subrect of view, should assume state associated

debugger for C/C++ and Java -

i use vim, debuggers used in modern ides such netbeans, visual c++, , eclipse , wondering if there debuggers except in standalone program? tried using gdb, seems debugging take lot longer using command line. tried ddd, little frustrating use since not display complex structures arrays. how debuggers in modern ides allow me click on down arrow view in arrays not know how in gdb or ddd. you have at: http://code.google.com/p/jswat/ it's standalone java debugger. i'm afraid doesn't support c++ debugging.

c# - HttpWebRequest Connection Limit and RestFUL server -

i have created server product connecting social network servers , sending data status update etc. server authenticated necessary social networks servers users using solution. actually, have no problem @ time, think will. my server open thousands of concurrent request neccessary servers via http c# httpwebrequest instance. know it's possible change concurrent request limits below propery. servicepointmanager.defaultconnectionlimit afaik, limit max 100 evet set more 100. so, faced bottleneck problem httpwebrequest change defaultconnectionlimit property of servicepointmanager. i know guys thinking this. have suggestions ? ignoring whether or not idea, have tried using unique connectiongroupname each request, e.g. guid.newguid().tostring()? connection limit per connection group may unless there global limit. should disable keepalive unless reusing group names subsequent requests. see answer httpwebrequest how handle (premature) closure of underlying tc