Posts

Showing posts from August, 2010

excel - Simplest way to modify a document "template" and print via WPF? -

the situation i have wpf program want print several documents using data. these documents exist excel spreadsheet , word document. what have tried opened xps file (saved xps excel) zip , pulled out page (it consists of single page) , slapped window grid, test. omg!! resources not found , red squiglies every where. fonts specified in xps represented in odttf file wpf not seem like. renaming .ttf doesn't appear work. layout appeared correctly, grid lines , not, hopeful. what rather not have do recreate files flow document, xps, or other xaml objects hand. layout pretty involved excel spreadsheet document. word doc not bad. so need know: 2 inputs using (word document, excel spreadsheet) how best these format print wpf. have code snippets allow me open excel, open spreadsheet, put data specified cells, print, issue close command, check program unload , kill if necessary. don't want anymore though. messy , can buggy requiring office interop assemblies , o...

How do you init a new Mercurial project with a different username? -

normally start new mercurial project: cd /project-directory hg init this uses username set somewhere on machine ( %userprofile%\mercurial.ini ) but on occasion want initialize project different username. is there option use hg init this? hg init doesn't use username @ (repo starts no changesets, @ revision null ). if want commit different username, use hg commit --user . you can set username in repository's hgrc ( .hg/hgrc ), in global 1 — commits repository use it.

Using jQuery in ckeditor within Liferay portal -

does know, how make jquery work in ckeditor plugin ? created plugin , loaded in ckconfig.jsp ckeditor.config.extraplugins = 'myplugin'; but problem jquery-1.4.4.min load liferay-plugins.xml (or in theme entire portal) isn't loaded in global context when plugin executes. can use jquery everywhere within portal successfully, not in ckeditor plugin. initialization of ckeditor kinda complex , don't see how it. the ckeditor.jsp, included tag, contains entire html document etc. third party javascripts, available ckeditor, included in ckeditor.jsp's head section. so should follows (ckeditor.jsp): <script type="text/javascript" src="ckeditor/ckeditor.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js"></script> and jquery available ckeditor plugins.

android - How an emailprovider.db gets populated? -

in android email app db emailprovider.db gets populated after fetching values server when configured using of protocols...in case exchange server ..i wanted know class files responsible populating data in tables of emailprovider.db after fetching data server.the source code used android 2.2. look @ localstore in sources of email app: https://android.googlesource.com/platform/packages/apps/email/+/froyo-release/src/com/android/email/mail/store/localstore.java

php 5.3 - why is this abstract class returning fatal Error in php -

abstract class myabstractclass{ abstract protected function dosomething(); function threedots(){ return "..."; } } class myclassa extends myabstractclass{ protected function dosomething(){ $this->threedots(); } } $myclass = new myclassa(); $myclass->dosomething(); this error being spitted out "fatal error: call protected method myclassa::dosomething() context in test.php on line 10 ".iam trying know reason error. you have declared function dosomething proteced, means can used inside parent classes, child classes or itself. you're using outside of that. you can try changing abstract protected function dosomething(); into abstract public function dosomething(); and protected function dosomething(){ into public function dosomething() {

Looking for a small project to do as an introduction to functional programming -

i've been reading on functional programming lot recently, , decided best way understand start using it. spent time looking @ different reviews of functional languages, , think i've settled on haskell because of supposed elegance , fact seems go-to pure functional language. i've been coding in java, python, , perl, figure exercise might pick language forces me use functional programming ideas rather scala or lisp supports imperative programming (but if has thoughts or opinions this, i'd love hear them). anyway, whole point learning ideas of functional programming (for me @ least) i've heard problems more naturally solved in way. , i've found it's better learn new things applying them somehow rather going through mindless tutorials. so, being said, straightforward problems/projects can learn essence of functional programming? try working through project euler challenges. harder go, tackling them 1 one functional programming point-of-view wa...

Explanation of performance considerations of read/write on Google Datastore (GAE)? -

i'm having difficult time understanding mechanics of google app engine datastore . want understand mechanics can build database in optimal way database. given example below, can me in: structure database optimally understand performance of both read , write given structure example: let's have n baseball players , each has unique id. i'd keep daily tally of homeruns hit each player (storing "total daily homeruns" property) , increment when homerun hit. so, time increases, i'd show graph of homeruns each day each baseball player on x years. player 1 1/21/2011 - 2 homeruns 1/22/2011 - 0 homeruns 1/23/2011 - 1 homeruns read requirement : read last 5 years of daily "homerun" data player? write requirement : increment daily homerun count baseball player. i love understand how structure data , mechanics of both read , write? simple storage task scale? all. i model requirements one-to-many relationship this: clas...

Global variable array pointer C programming -

i'm working on project need array of pointers structs. have created global variable functions manipulate array hold pointer array can access functions. however, i'm running problems pointer just...changes , isn't pointing right thing anymore. i create array so: void initpqueue() { eventptr pqueue[qsize]; int i; float t; for(i = 1; < qsize; i++) { t = getnextrandominterval(getl()); pqueue[i] = createevent(t); } setpqueue(pqueue); buildpqueue(); } i use setpqueue(pqueue) set global variable....like so... void setpqueue(eventptr* pqueue) { pqueueptr = pqueue; } the global variable declared as: eventptr* pqueueptr; here struct: (in .h file.. atm) struct event { float etime; double stime; int status; }; typedef struct event event; typedef struct event* eventptr; everything awesome till point. buildpqueue works right... using pqueueptr .... however...i went make test functions output pque...

LINQ foreach during list creation -

i have simple linq statement builds huge monster list of around 8 billion items. each of items looped through , operation performed on item. problem foreach not run until list created. possible use linq , have execute foreach each item builds instead of waiting? i not doing in list sorting. straight list building. edit: may seem wierd, have database rows several numeric values. know arithmetic combination of values yields number want, not sure which. created following linq: ( i1 in items i2 in items i3 in items i4 in items select new item[] { i1, i2, i3, i4 } ).tolist().foreach(x => calculatevalues(x); i did above statement 1 item 2 items , on. computer hung while @ 3 items 28 million items. i know inefficient, going quick program run overnight. don't call tolist() method try load whole data in memory try this, var q = i1 in items i2 in items i3 in items i4 in items select new item[] { i1, i2, i3, i4 }; foreach(v...

c# - Using ITextSharp to generate XPS documents instead of PDF? -

i'm using itextsharp generate pdf files. possible generate xps files? , if yes, how? can't find documentation. thanks! itextsharp library built generate pdf files, not going create xps files you. system.windows.xps namespace provides methods writing xps documents code .net 3.5 , higher.

java - JSON VS simple string manipulation to parse HttpRequest in Android -

i face common case of having extract information in remote server via httppost request. imagine in case of weather app retrieving weather info. the server send long inputstream , interested in extracting information stream. keep in mind in memory-cpu bound environment. we have 2 options: 1) use json or xml parser extract informations. this recommended method, has disadvantages: it painfully verbose, if want little information big stream. it should faster , more garbage collection-friendly, i'm not sure case aforementioned case (little information big stream). 2) use simple string manipulation (ssm): we reduce dimension of inputstream grossly trimming off useless infos, , extract informations compact string. purpose, can build filters using static methods, reduce work of garbage collector. also method has disadvantages: i think method discouraged the more informations extract, slower method is. think there critical point in performance curve ssm becomes ...

c# - Import CSV into a DataTable -

possible duplicate: how read csv file .net datatable i have problem in project, trying read data in csv file, want convert data datatable. how can this? my code: system.data.odbc.odbcconnection conn; datatable insdatatable = new datatable(); system.data.odbc.odbcdataadapter da; string folder = files.fullname; string file = system.io.path.getfilename(fupload.postedfile.filename); conn = new system.data.odbc.odbcconnection(@"driver={microsoft text driver (*.txt; *.csv)};dbq=" + folder + ";extensions=asc,csv,tab,txt;persist security info=false"); da = new system.data.odbc.odbcdataadapter("select * [" + file + "]", conn); da.fill(insdatatable); it gives error : error [42s02] [microsoft][odbc text driver] microsoft jet database engine not find object 'test.csv'. make sure object exists , spell name , path name correctly. i checking there file 'test.csv' , file path correct :( couple ...

actionscript 3 - swapChildrenAt, setChildIndex, swapChildren all duplicating MC's -

first time poster here. this issue reproducible on machine new .fla project in actionscript 3.0 in flash professional cs5. it's edit of original question more information. i'm working on project load external swf's , search through instance names matching keywords, namely 'drag' , 'drop' identify movieclip matches, attach event listeners these mc's contain d&d event listeners , code. the specific problem switching of depths movieclips nested in dynamically loaded external swf files. where having trouble specific commands: swapchildrenat, setchildindex, swapchildren, removechild/addchild. i've tried 4 same problem of duplication. let me explain. when draggable mc clicked, moved top index of dynamically loaded swf it's visible above else in swf. problem trying of these commands duplicate mc. happens this: mouse_down event fires: index of target mc recorded '2', index switch '20' (maximum index of swf) setchildi...

javascript - Java/JS/JSTL - how to get property from javabean/display error message -

this question has answer here: access java / servlet / jsp / jstl / el variables in javascript 2 answers in html, need property bean , store in variable - how can this? what i'm trying is, display error message when user's login fail - know can javascript, don't know how can "call" javascript load when login unsuccessful. many ways this.. don't know how of them. like html , css, js part of template text. let jsp print if js variable. <script>var foo = '${bean.foo}';</script> you need make sure generated html looks way js understands it. <script>var foo = 'bar';</script> with jsp/jstl/el can control output whatever way want. can use jstl <c:if> print conditionally. can use el conditional operator ${condition ? printiftrue : printiffalse } toggle output based on condition. et...

c++ - Compilation Error on Recursive Variadic Template Function -

i've prepared simple variadic template test in code::blocks, i'm getting error: no matching function call 'outputsizes()' here's source code: #include <iostream> #include <typeinfo> using namespace std; template <typename firstdatatype, typename... datatypelist> void outputsizes() { std::cout << typeid(firstdatatype).name() << ": " << sizeof(firstdatatype) << std::endl; outputsizes<datatypelist...>(); } int main() { outputsizes<char, int, long int>(); return 0; } i'm using gnu gcc -std=c++0x . using -std=gnu++0x makes no difference. here's how disambiguate base case: #include <iostream> #include <typeinfo> template <typename firstdatatype> void outputsizes() { std::cout << typeid(firstdatatype).name() << ": " << sizeof(firstdatatype) << std::endl; } template <typename firstdatatype, typen...

keyevent - android SEND key crashes -

i have need check enter key start search routine. works except keyboards seem have send button instead of enter button. when pressed code dumps. have small sample below. ideas? tx1.setoneditoractionlistener (new oneditoractionlistener() { @override public boolean oneditoraction(textview v, int actionid, keyevent event) { system.out.println("key: " + event.getkeycode()); //blows here if (event.getaction() == keyevent.action_down) { if (event.getkeycode() == keyevent.keycode_enter) { // ... } } } } i believe event null in case. detecting send action on softkeyboard oneditoractionlistener should this. oneditoraction(textview v, int actionid, keyevent event){ if(actionid == editorinfo.ime_action_send){ send(); } return false;// softkeyboard still close after pressing 'send' }

Plotting two time dependant graphs with MATLAB -

Image
basically, have 2 functions. p1 , p2. p1 kicks in @ t=0 , runs few seconds (a trig function). p2 starts, it's , exponential decay. below i'm trying do. i've tried create time matrix , ode solver. need way of plotting both functions on sigle graph,. any highly appreciated. alpha=20 beta=4.9139 h0=-0.0116 a=959; p01=100; p02=100; r=0.5; c=0.1; from t01-t1 (0.639s) h=(exp(alpha*t1)/(alpha^2)+(beta^2)).*(alpha*sin(beta*t1)-belta*cos(beta*t1)); g=(a*h0/c)-p01; p1=((a*h)/(c-g))*exp(-t1/r*c); then: t02-t2 (1.278s) p2=p02*exp(-t2/(r*c)) with alpha=20; beta=4.9139; h0=-0.0116; a=959; p01=100; p02=100; r=0.5; c=0.1; t1 = 0:0.001:0.639; h=(exp(alpha*t1)/(alpha^2)+(beta^2)).*(alpha*sin(beta*t1)-beta*cos(beta*t1)); g=(a*h0/c)-p01; p1=((a*h)/(c-g)).*exp(-t1/r*c); t2 = 0.639:0.001:1.278; p2=p02*exp(-t2/(r*c)); i.e. defining time vectors t1 , t2 going steps of 0.001s, following graph (note multiplied p2 10^8, because y-scales rather different. figure...

c# - Dynamically switch WCF Web Service Reference URL path through config file -

how dynamically switch wcf web service reference url path through config file ? are wanting override url in config different url. have test service , live service. can this. client.endpoint.address = new endpointaddress(server.isliveserver() ? @"liveurl" : @"testurl"); where url come wherever want

How to manage multiple projects based on the same template in git? -

i wrote simplistic , generic piece of blogging software using rails have hosted on github. i'm relatively new using git, use project template designing project need similar functionality (ability post something, leave comments on it, etc). want ability push changes new project old one, should find bug or come new common piece of functionality want push back. what correct way handle setup in git? should fork original or clone , push new repository add original second remote, or else entirely? cloning forking in case, there’s no difference. in both cases history, need (or rather, specify/defaults). the approach mentioned way go, yes. you can push individual changesets original repo later on apply changes there well.

ruby on rails - 'Validation failed - Client application can't be blank' using oauth-plugin and mongoid -

i'm new rails3 , ruby in general, may running issue ruby oauth-plugin itself. i'm attempting use consumer portion of logic authorize web app user's twitter account. setup point i'm redirected twitter authorization, when user redirected app, receive error when token being saved mongodb database: mongoid::errors::validations in oauth consumerscontroller#callback validation failed - client application can't blank. after stepping through framework code, can see token class expecting client_application_id have value, didn't think consumer token should associated clientapplication model? one thing note i'm using latest branch of oauth-plugin includes fixes 3en mongoid, , way can models work using 'referenced_in' instead of 'embedded_in'. doing wrong here? thanks in advance, rob application trace: app/models/consumer_token.rb:25:in `find_or_create_from_access_token' app/controllers/oauth_consumers_controller.rb...

c++ - Why is wparam changing if i use same message, with same paras? -

i trying implement code http://www.codeproject.com/kb/threads/winspy.aspx (subclassing part) project having problems, debugged dll , seems when send exact same message(or think) hooked thread's hwnd message appears different(i see debugging dll file directly trough visual studio). so start, share custom winregistered mssg dll instances.. here writting use both projects(the 1 downloaded site above, , current 1 tries mimic same strategy) i first share message register later(in dll process atach) dll instances.. #pragma data_seg("shared") uint wm_hookex = 0; #pragma data_seg() ok time register when dll attaches... bool apientry dllmain( handle hmodule, dword ul_reason_for_call, lpvoid lpreserved ) { if( ul_reason_for_call == dll_process_attach ) { g_hinstdll = (hinstance) hmodule; ::disablethreadlibrarycalls( g_hinstdll ); if( wm_hookex==null ) ...

Use jQuery to attach behavior after a new element has been added to the DOM? -

i'm using jeditable, turns div nice little form complete textarea, cancel , submit buttons on-the-fly. after jeditable creates textarea created , adds dom, i'd attach elastic plugin element (so textbox expands , shrinks nicely). i'm using $.live() - waits user click on form, attaches elastic plugin. it cool if attach elastic right after element created - without messing around plugin code - possible? don't use .live() . instead, after have initialized jeditable plugin chain click event handler $(function() { $('.edit').editable( 'http://www.example.com/save.php', { type : 'textarea', cancel : 'cancel', submit : 'ok', tooltip : 'click edit' } ) .click(function() { $(".edit textarea").elastic(); }); }); try fiddle http://jsfiddle.net/kkg2b/1/

content management system - PHP: Directory Navigation Menu -

i have question haven't been able find answer/script to. i'm learning use php. i'm using perch cms , has been going great far. i've run snag when comes adding new pages. want php able create dynamic navigation menu directory. for example, have 3 pages in 'about' directory. root /about /index.php - page2.php - page3.php i want able output side navigation menu based off directory. home - page2 - page3 and when client/user creates new page, it'll automatically add list. so... root /about /index.php - page2.php - page3.php - newpage.php ...creates... home - page2 - page3 - new page can point me direction of script or me started? thanks! there quite few php functions iterate through directories. think cleanest using php spl (standard php library)'s directory iterator. http://www.php.net/manual/en/class.directoryiterator.php $dir = new directoryiterator('about'); foreach ($dir $fileinfo) { if (!$fileinfo->i...

iphone - How to show more text on annotation view -

i have created iphone app loads map using mkmapkit . when clicking on map, shows mkannotation title , subtitle strings. now want know how can show annotation multiple lines of text. please show me how it. time , help. check out mapcallouts demo apple.

sql - PHP foreach loop problem -

i have following code: //generate 10 top tags $tagsql = mysql_fetch_array(mysql_query("select * tags")); $toparray = array(); foreach($tagsql $poland) { if($poland["tagid"] == 1) { $toparray[0] ++; } if($poland["tagid"] == 2) { $toparray[1] ++; } if($poland["tagid"] == 3) { $toparray[2] ++; } if($poland["tagid"] == 4) { $toparray[3] ++; } } function printtoptags() { $n = 0; foreach($toparray $buddha) { $n = $n + 1; if(sizeof($toparray) > $n) { $hersheybar = " "; } else { $hersheybar = ""; } $finalfinalendarray = mysql_fetch_array(mysql_query("select tagname tags tagid = '$buddha'")); foreach($finalfinalendarray $waterbottle) { echo $waterbottle . $hersheybar; } } } i er...

How to import canvas.draw object into a layout in Android? -

i not need setcontentview() method. tell me one. yes, need setcontentview(). there 2 types--one takes resource id , 1 takes view object (and, optionally, layoutparams object). practical ways add content activity. cannot draw directly activity; have use view of sort. can create own custom view described here .

Android and popping from Activity C to Activity A or B -

i have 3 activities in activity stack, (main) -> b -> c. a starts b starts c. my c dialog box 1 button take me , 1 button take me b. activity b must therefore have history, if c calls finish() end in b. given this, how (efficiently) set up? i.e. how (efficiently) go c a? i assume want finish() b if user selects button on c. have b start c result ( startactivityforresult() ) , have c send b result. if result "go a", b can finish().

mapreduce - Hadoop Streaming with very large size of stdout -

i have 2 programs hadoop streaming. mapper (produces <k, v> pair) reducer of course, <k, v> pairs emitted stdout . my question if v in <k, v> large, run on hadoop efficiently? i guess v emitted mapper 1g or more (sometimes more 4g). i think such sizes of value cause problem, because problematic manipulate them in memory. if indeed need such huge values, can put them hdfs , make v name of file. problem should consider in case fact approach no longer functional - have side effect, example failed mapper.

wpf - Change tab on button click event -

i change different tab when click button. xaml follow: <tabcontrol name="tabcontrol1" margin=" 5" selectedindex="0"> <tabitem header="properties" opacity="1"> <grid width="1185" height="945" background="snow" > </grid> </tabitem> <tabitem header="others"> <grid> </grid> </tabitem> </tabcontrol> and button click event: private void buildbutton_click(object sender, routedeventargs e) { tabcontrol1.selectedindex = "1"; } is there wrong? "cannot implicitly convert type 'string' 'int'" appears remove quotes: tabcontrol1.selectedindex = 1;

PHP array minor problem -

i'm not sure how explain this. it's simple can't fathom why it's not working. i have loop. puts bunch of strings array. if fill single variable given string, output perfectly. but filling an array strings make give me dreaded: array array array array array array array array note: strings not 'array'. the way loop is: while(...) { $arr[] = $resultfromloop; } here var_dump. array(1) { ["tagname"]=> string(5) "magic" } array(1) { ["tagname"]=> string(4) "nunu" } array(1) { ["tagname"]=> string(5) "books" } array(1) { ["tagname"]=> string(0) "" } array(1) { ["tagname"]=> string(3) "zzz" } array(1) { ["tagname"]=> string(4) "grey" } array(1) { ["tagname"]=> ...

silverlight - RIA services: Load returning no data -

in bookclub example application nikhilk kothary, combobox used display book categories. it in viewmodel class (the application using mvvm pattern): private referencedatacontext _referencedata; public bookclubmodel() { // constructor _referencedata = new referencedatacontext(); _referencedata.load(_referencedata.getcategoriesquery(), false); } then there property comboxbox bound: public ienumerable categories { { return _referencedata.categories; } } why working? shouldn't have "completed" event handler load operation? if want fill ienumerable property in constructor, not working: private referencedatacontext _referencedata; private ienumerable _categories; public bookclubmodel() { // constructor _referencedata = new referencedatacontext(); _referencedata.load(_referencedata.getcategoriesquery(), false); _categories = _referencedata.categories; _referencedata.categories returning in categories property above. } why...

css - Issues with negative z-index in IE8 -

i using 2 pseudo elements create banner effect on div, so: div { position: relative; width: 200px; background-color: #999; } div:before, div:after { content: ""; width: 10px; height: 0; display: block; position: absolute; z-index: -1; top: 10px; border-top: 10px solid #666; border-bottom: 10px solid #666; } div:before { right: -20px; border-right: 10px solid transparent; border-left: 10px solid #333; } div:after { left: -20px; border-left: 10px solid transparent; border-right: 10px solid #333; } it works fine in ff, chrome, safari & ie9, no luck ie8. 2 elements z-index of -1 show above parent. there way work? you should try setting z-index of 1 div .

sql - Access Query - Compare Multiple User Selections Against Each Other -

i'm running conceptual problem cannot seem conquer in mind. let's want user enter they're wearing database via form. throwing 't-shirt' , 'blue' in new row incredibly easy. however, let's want compare 1 users against others, , rank in order similar least. this becomes huge nightmare when consider amount of options available. undershirt overshirt jacket scarf/necklaces headwear pants underwear leggings socks footwear accessories as see it, hard-code in 11 categories above , let user make selections drop-drop boxes tailored each category. now, let's use example of 'undershirt' , 'overshirt'. depending on person, long-sleeved shirt used either; they're still wearing one. if make users put values in categories, user might put in 1 , user b might in category. , wouldn't compared because of that, separate categories. now, instead of hard-coding in categories (and making limit of how user can enter), put...

How to print the hibernate parameter binding information? -

i have googing,and not work. this log4j.properties: # stdout set consoleappender. log4j.appender.stdout=org.apache.log4j.consoleappender log4j.appender.stdout.layout=org.apache.log4j.patternlayout log4j.appender.stdout.layout.conversionpattern=%-4r [%t] %-5p %l %x - %m%n log4j.rootlogger=info, stdout,requestout log4j.logger.org.hibernate=info; log4j.logger.org.hibernate.sql=debug; log4j.logger.org.hibernate.type=trace; but when start app,i can log like: hibernate: select logentry0_.uri col_0_0_, count(logentry0_.uri) col_1_0_ app.t_log logentry0_ logentry0_.time between ? , ? group logentry0_.uri order col_1_0_ desc i can not see value set parameter. any ideas? it looks correct in general, think strange write trace instead of trace , ; @ line end new me. so guess problem log4j syntax.

How to show maven artifact version in eclipse Package Explorer -

i using eclipse helios , m2eclipse plugin. wonder if possible configure plugin (or eclipse) show maven artifact version beside project folder in package explorer (i have open pom.xml check version working on - on projects open seldom). other plugins add information next project folder (like e.g clearcase view name). nice if possible eclipse/m2eclipse , artifact version. any idea? thanks klaus window>preferences>general>appearance>label decorations>maven version decorator

asp.net - Getting Textbox value in Javascript -

i trying value of textbox in javascript, not working. given below code of test page <%@ page title="" language="vb" masterpagefile="~/site.master" autoeventwireup="false" codefile="test3.aspx.vb" inherits="test3" %> <asp:content id="content1" contentplaceholderid="headcontent" runat="server"> <script language="javascript"> function getalert() { var testvar = document.getelementbyid('txt_model_code').value; alert(testvar); } </script> </asp:content> <asp:content id="content2" contentplaceholderid="maincontent" runat="server"> <asp:textbox id="txt_model_code" runat="server" ></asp:textbox><br /><br /> <input type="button" value="db function" onclick="getalert()" /><br /> </asp:content> so ...

SQL select only first with a given name -

houses id ownerid street ----------------------- 1 owner1 street1 2 owner2 street1 3 owner3 street2 4 owner4 street2 5 owner5 street3 as can see there can more owners on same street i have table want insert owners houses table, 1 each street result of query: table streetrepresentant ownerid street ------------------ owner1 street1 owner3 street2 owner5 street3 ( ownerid pk table, if matters. ownerid unique in table houses ) the query should like: insert streetrepresentant (ownerid , street ) select ownerid , street houses --what should here 1 owner each street? ... you can group street, use min() function return lowest (as per example) ownerid each street. select min(ownerid) , street houses group street

c# - help me with the linq query syntax to read elements not in a range -

i'm trying remove reports list, not created in range of calender weeks (a property of each report). since want learn linq, started this: list<reporte> reports = readallreports(); list<sbyte> importantweeks = getrelevantweeks(); // e.g. 49,51,52,1,2,3 // remove irrelevant reports (from irrelevant calender weeks) doesn't work ienumerable<reporte> importantreports = onereport in reports onereport.kalenderwoche ??inrange importantweeks?? select onereport; could me correct syntax linq statement? thanks help! i suspect want: var importantreports = onereport in reports importantweeks.contains(onereport.reportweek) select onereport; which written more concisely as: var importantreports = reports.where(x => importantweeks.contains(x.reportweek)); note if importantweeks becomes larger, may want consider using hashset<int> instead of list<int>

sorting - Extending Seq.sortBy in Scala -

say have list of names. case class name(val first: string, val last: string) val names = name("c", "b") :: name("b", "a") :: name("a", "b") :: nil if want sort list last name (and if not enough, first name), done. names.sortby(n => (n.last, n.first)) // list[name] = list(name(a,b), name(c,b), name(b,a)) but what, if i‘d sort list based on other collation strings? unfortunately, following not work: val o = new ordering[string]{ def compare(x: string, y: string) = collator.compare(x, y) } names.sortby(n => (n.last, n.first))(o) // error: type mismatch; // found : java.lang.object ordering[string] // required: ordering[(string, string)] // names.sortby(n => (n.last, n.first))(o) is there way allow me change ordering without having write explicit sortwith method multiple if – else branches in order deal cases? well, trick: names.sorted(o.on((n: name) => n.last + n.first)) on other...

Add custom GET Parameter logic to restful class in Ruby on Rails -

i have userscontroller , registrationscontroller handle user signups devise in rails. i adding code affiliate sign ups, in order map users affiliates using custom http parameter called "a". so example, want sign respond this: www.app.com/users/sign_up?a=affiliate_code however, rails doesn't respond params[:a] in controller. in routing file, have resources :users what easiest , rails way implement this? you need setup action sign_up in routes.rb or can use default new method create user. should params 'a' without problem.

language agnostic - Best way to handle multiple files adding/editing/deleting in web applications from ui point of view? -

application platform www. i have user interface dilema. user can have many files. file has attributes such name , description can changed user. currently have users list edit action when allow edit user data such name, address, phone etc. on 1 screen, , files list links edit or delete individual file on screen. i think nice allow user edit data , adding/editing/deleting files on 1 screen, assuming it's www think that: it not easy develop maybe little confusing user, because can expect every one-to-many relation user has can managed edit screen i'm interested in solutions similiar problems. have @ jquery datatables: http://www.datatables.net/ they provide neat , usable way arrange data (eg. use 1 row per file columns editing, deleting etc) way have on same page user's own details (i think that's wanted?)

How to interchanging the option element in Multiple select using javascript -

(move or down option element) how interchanging option element in multiple select using javascript ex. mail id first name last name user type city letter display mail id first name last name user type city i want change option mail id last name first name user type city how can interchanging options using javascript the easiest way (but least optimized) all, rearrange (send id or number or function) , recreate element. the optimized version use insertbefore(element, document.getelementbyid("elementcontainer").child), child child before want insert.

php - explode and in_Array search not working -

possible duplicate: explode , in_array search not working codepad here http://codepad.org/zqz0kn3r function processcontent($content, $min_count = 2, $exclude_list = array()) { $wordstmp = explode(' ', str_replace(array('(', ')', '[', ']', '{', '}', "'", '"', ':', ',', '.', '?'), ' ', $content)); $words = array(); $wordstmp2 = array(); $omit = array('and', 'or', 'but', 'yet', 'for', 'not', 'so', '&', '&amp;', '+', '=', '-', '*', '/', '^', '_', '\\', '|'); if(count($exclude_list)>0){ $omit = array_merge($omit, $exclude_list); } foreach ($wordstmp $wordtmp) { if (!empty($wordtmp) && !in_array($wordtmp, $omit) && strlen($wordtmp) >= $min_count) { $word...

sql server ce - Sql Compact 3.5: Limit number of rows in column -

i have table rows of following form: timestamp data: keep newest n rows in table, , delete rest. is there way specify deletion of except n newest rows? delete table id not in ( select top 30 id table order timestampcolumn desc ) here n = 30 . can replace number 30 number want retain.

java - Is is possible to write cache in application for cluster enviroment? -

i know there cache products supporting cluster, jboss cache etc. but jboss cache works jboss server , it's not application-level component. possible write own cache cluster in application? each application instance cannot know other instances in cluster, true? have checked infinispan ? it's jboss too, has api control programatically. clear, don't need run jboss, need add infinispan jar in app.

How do I select dates between two given dates in an Oracle query? -

how select dates between 2 given dates in oracle query? select to_date('12/01/2003', 'mm/dd/yyyy') - 1 + rownum d all_objects to_date('12/01/2003', 'mm/dd/yyyy') - 1 + rownum <= to_date('12/05/2003', 'mm/dd/yyyy') from http://forums.devshed.com/oracle-development-96/select-all-dates-between-two-dates-92997.html

javascript - Passing elements as variables to function -

i'm having issue element object , jquery function: html <label for='state'>state</label> <input id='state' name='state' type='text' value=''/> <span class='info'><img class='tick' /><img class='cross' /></span> javascript / jquery var state = $("#state"); function validatefield(myelement) { if (myelement.val().length > 3) { alert("word"); } else { alert("sup"); } } state.blur(validatefield(state)); state.keyup(validatefield(state)); nothing happens on page load, when state has more 3 chars entered. any ideas? awesome - learning new stuff ftw no need arguments @ all, event handler bound element can use this keyword inside function: var state = $("#state"); function validatefield(event) { if (this.value.length > 3) { // <-- use `this.value` instead alert(...

tree - Problem selecting a new created node on a JSF UITree -

i use uitree recursivetreenodesadaptor, showing nodes correctly. when create node selected leaf, want former leaf expanded , new created node selected. i'm trying use walk method of tree datavisitor , method process, seems rowkey of node created isn't updated when gets there... ex-leaf new parent there , can expand correctly. any suggestions? thanks

android - Get Geopoints of <insert storechain> stores? -

is there way geopoints of storechain's stores? if f.e search ikea, walmart etc gather geopoints locations google map or other tool plot. you might want google api license geocoding . doing name search address , geocoding gps, google api has limitations on how can use service how many requests per day (2500) , must show data on google map, etc

How do I use http-authentification with Liferay? -

how users authenticate http-auth before can access liferay? more specific: how use http-auth instead of liferay's sign-in page or portlets. access liferay should blocked unless credentials have been presented http-auth. i can't speak directly how liferay works, however, in jboss portal have manually modify portal's web.xml include appropriate authentication mechanism , desired roles. i assume liferay same course of action since both java-based web applications @ cores.

c# - How to cut/crop/trim a video in respect with time or percentage and save output in different file -

is there tutorial or c# library which me accomplish following chose file edit ask user select cut/crop/trim method :- time or percentage cut/crop/trim video time or percentage chosen ( wish reduce 5 minute video 4 minute video, or reduce video 80%) save video requested in required path now steps 1) , 4) have implemented not find c# library accomplish 3) , 4) i looked ffmpeg library not find c# wrapper accomplish requirements any be appreciated thank you ffmpeg powerful application , have used many times, c#. don't need c# wrapper library. have execute ffmpeg commands c# using: system.diagnostics.process.start(string filename, string arguments); or use system.diagnostics.processstartinfo redirect standard output if need to. this article explains how use system.diagnostics execute synchronous , asynchronous commands, etc. http://www.codeproject.com/kb/cs/execute_command_in_csharp.aspx here's simple example of how cut video file down first...

How to create a textbox (from toolbox) in asp.net mvc2 web application? -

the toolbox says there no usable control in group? i have create textbox in asp.net mvc2 web application? please explain. the toolbox habit might have learned webforms development no longer applies in asp.net mvc. in asp.net mvc write code. , generate textbox ( <input type="text" ... ) use textboxfor html helper: <%= html.textboxfor(x => x.someviewmodelproperty) %> or if don't have typed view (although should if want designed mvc application) <%= html.textbox("someviewmodelproperty") %> so goodbye server controls , toolboxes , hello asp.net mvc .

c++ - kbhit equivalent for Windows CE -

i know question has been asked before , have tried searching on google don't seem able find decent answer this. i want console application writing exit when user presses button. it's written in c++ , deployed on windows ce6. currently same code, on xp, uses perform actions until keyboard hit //app entry while (!_kbhit()) { /* awesome code goes here */ } //app exits here can me :) have tried getchar() ? it may necessary direct standard input/output console using setstdiopathw() . -paulh

sharepoint - Custom actions migration from SP 2007 to 2010 -

i have custom action defined in sharepoint 2007 feature. adds new item document library menu. <customaction id="userinterfacelightup.mobiusdiscretionaryarchivinglibmenu" registrationtype="list" registrationid="101" groupid="actionsmenu" location="microsoft.sharepoint.standardmenu" sequence="1002" imageurl = "/_layouts/images/myimage.gif" title="my title"/> when deploy sp 2010 same behavior 2007 ui mode , these actions becomes available "custom commands" in 2010 ui mode. there way not allow menu appear in "custom commands". create ribbon buttons 2010 ui mode , menus 2007 ui mode only. thanks beforehand. have @ our series porting sharepoint 2007 solution 2010 while maintaining compatibility both. in summary, solve problem maintain separate sphive_2010 folder contains files used overwrite sp2007 specific ones during build process. build 2 sep...

MySQL UNIQUE Constraint with a condition -

i'm trying create unique index constraint 2 columns (id_1 , id_2) following condition: if 2 different rows have same value in id_2 column, values in id_1 column must same. is possible? thanks. there no declarative constraint support such restriction. scenario describe not satisfy requirements unique constraint. (you can create constraint, won't able add more 1 row identical values id_1 , id_2. if intent reject insert or update based on restriction, might able accomplish row-level trigger.

in this jquery-ui example, what is the expected json from the server? -

in this example should returning array in json or single comma seperated string? this requested link, , returns json: http://jqueryui.com/demos/autocomplete/search.php?term=t

iphone - NSNotification not being received in a UIViewController whose view is a subview of a UIScrollview -

i'm trying subscribe myviewcontroller custom nsnotification. view heirarchy looks this: window - rootviewcontroller.view - scrollview - myviewcontroller.view the notification being sent [nsnotificationcenter defaultcenter] button inside rootviewcontroller's view. rootviewcontroller listens notification , responds fine. i have same exact "listening" code inside myviewcontroller, it's not receiving notification reason. if it's part of app should receive notification, correct? have debug message inside myviewcontroller's initwithnibname method, know it's subscribing notification. tried having myviewcontroller listen notifications setting notification name nil. example: nslog(@"main view controller initialized"); [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(statusbarvisibilitychanged:) name:nil object:nil]; but no luck there either. has seen happen before nsnotifications? any id...

python - How to ensure a safe file sync with sqlite and NFS -

i have converted workspace file format application sqlite. in order ensure robust operation on nfs i've used common update policy, modifications copy stored in temp location on local harddisk. when saving modify original file (potentially on nfs) copying on original file temp file. open orginal file keep exclusive lock on else tries open warned else using it. the problem this: when go save temp file on original file must release lock on orginal file, provides window else in , take original, albeit small window. i can think of few ways around this: (1) being dump contents of temp in orginal using sql, i.e. drop tables on original, vacumm original, select temp , insert orginal. don't doing sql operations on sqlite file stored on nfs though. scares me corruptions issues. right think this? (2) use various files act guard prevent other coming in while copying temp on original. using files mutex problematic @ best. don't idea of having files hanging around i...

PHP XPATH within changing XML structure -

i've xml file this: <tr class="station"> <td class="realtime"> <span> 15:11 </span> </td> </tr> <tr class="station"> <td class="clock"> 15:20 </td> </tr> <tr class="station"> <td class="clock"> 15:30 </td> </tr> <tr class="station"> <td class="realtime"> <span> 15:41 </span> </td> </tr> and wanna parse xpath in php. xml been updated , parsed quite often. want first time (in case 15:11) problem not sure whether surrounding tag td class "clock" or "realtime". if there surrounding realtime, there span tag within. otherwise not. in fact, first "station"-class tag in information is, matters. possible tell xpath evaluate within tag? there method doing in xpath? (sry bad eng...

ms access - Adodb and Kohana 3 -

i want connect msaccess database using adodb. dunno how start such problem. there can tell me? need easy tips. best place start check doc @ link: http://phplens.com/lens/adodb/docs-adodb.htm the manual adodb has examples ms access

Is there any way to import Eclipse 3.4 keybindings/keyboard preferences into Eclipse 3.6? -

i've tried exporting eclipse 3.4 keys pref pane, creates .csv file , eclipse 3.6 seems want import .epf files (via file -> import...). there way this? sadly, eclipse 3.6 (and older versions) cannot import key bindings csv files. if have .csv file of key bindings , you're not able re-export bindings .epf, out of luck. as people expect, changing file extension .csv .epf not work. epf files contain xml, while csv files are, well, comma-separated values. 1 write program convert csv epf, i've not seen 1 available.

javascript - JS to popup my webpage in a third-party site -

i need popup webpage within our customer's websites. webpage gathers data in input boxes , closes --- ie. it's basic form , need display , give close button user. what's best js tool this? found colorbox , looks cool, concerned break customer's site requires jquery (and customer may using older version colorbox pulls in). my opinion struggle achieve given cross-site scripting prevention mechanisms in browsers. you cannot load page using ajax domain example. you can load page using "workaround", uses javascript load content external url document.writing javascript script tag url of page, mimics http get. (example here xss ) you not able post resulting form site, javascript read form data , create request building querystring of url. edit <iframe id="myframe" style="display:none" src="mysite.com/page"/> ... function show() { document.getelementbyid("myframe").style.display = "block...

jquery - How to apply Fancybox to DIVs -

brief background: started getting coding websites. current website jamesendres.com , want use fancybox move div called project, left & right depending on arrow clicked inside of its' parent div projectcontainer. i've read through documentation , feel examples lack in regards beginner coders. additionally extensively searched google , so. question if able point me in right direction of how apply fancybox current website. what wanted do: when right arrow click move right: same goes left respectively. update pager position i.e. 01/02 also if notices redundant coding techniques or have constructive criticism plenty open it. good/practical coding style

php - Send Mail from raw body for testing purposes -

i developing php application needs retrieve arbitrary emails email server. then, message parsed , stored in database. of course, have lot of tests task not trivial different mail formats under sun. therefore started "collect" emails clients , different contents. i have script can send out emails automatically application test mail handling. therefore, need way send raw emails - structure same come respective client. have emails stored .eml files. does know how send emails supplying raw body? edit: more specific: searching way send out multipart emails using source code. example able use (an email plain , html part, html part has 1 inline attachment). --apple-mail-159-396126150 content-transfer-encoding: quoted-printable content-type: text/plain; plain text email! --=20 =20 =20 --apple-mail-159-396126150 content-type: multipart/related; type="text/html"; boundary=apple-mail-160-396126150 --apple-mail-160-396126150 content-transfer-...

reporting services - SQL Server - SSRS - Where to find query generating the report -

the guy created reporting using ssrs has left, , trying troubleshoot 1 of reports being generated. how access @ query generating report. this give listing of reports xml report definition: select name, cast(cast(content varbinary(max)) xml) reportxml reportserver.dbo.catalog type = 2 order name the info want in datasets section, example below. there may more 1 query / stored procedure in report. <datasets> <dataset name="salessummary"> <query> <commandtype>storedprocedure</commandtype> <commandtext>rptsalessummary</commandtext> <queryparameters> <queryparameter name="@startdate"> <value>=parameters!startdate.value</value> </queryparameter> <queryparameter name="@enddate"> <value>=parameters!enddate.value</value> ...

actionscript 3 - Getting a null object reference error for a button instance -

i trying use script jump point on timeline: feature1_btn.addeventlistener(mouseevent.click, feature1); function feature1(event:mouseevent):void { gotoandplay(620); } i have instance of button labeled "feature1_btn". why getting error? you're getting error because you're attempting add listener instance before instance has been created and/or initialized. if code in timeline need make sure feature1_btn exists on stage @ point in timeline.

How to Execute SAP RFC using SOAP? -

i have requirement need run rfc etl (datastage) job. can done executing unix command also, of course (the datastage server unix). don't think have sap plug-in datastage, though. i've tried , succeeded using startrfc command fired unix script, client's preferred solution using soap - whih don't know about, have url rfc. now, if knew how use it... any ideas? experiences? tutorials? i'm grasping @ straws @ point. quite, quite different stuff i'm used to. any , appreciated! like ben said, should ask sap responsible soap endpoint in system. if or sap staff looking explanation how expose rfc web service, there lot of articles on sap developer network. e.g. one: http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f02b33fc-9eb1-2c10-0599-f2ef9fb5c5b6?quicklink=index&overridelayout=true

Magento - product options view or controller file -

in file $magento_pathapp/design/frontend/base/default/template/catalog/product/view/options/wrapper.phtml , see following line of code: <?php echo $this->getchildhtml('', true, true);?> this responsible printing product options on product page. want understand , modify html content line of code produces, can't seem locate view or controller relevant it. example, let's want programmatically add characters &nbsp; innerhtml of each option element in drop down, phtml, php or html file edit? i'm hoping answer question me understand how retrieve product options, in turn me solve more immediate problem: magento - query product options when passing empty value of getchild functions children used. in case getchildhtml(''... returns result of each of tohtml outputs. to find out it's children need refer catalog.xml layout file: <block type="catalog/product_view" name="product.info.options.wrapper" as=...

c++ - Making TCHAR* compatible with char* -

so quick question how make tchar* (or wchar_t macro) work char*? i using unicode character set. the code problem is: tchar* d3ddevtypetostring(d3ddevtype devtype) { switch (devtype) { case d3ddevtype_hal: return text("d3ddevtype_hal"); case d3ddevtype_sw: return text("d3ddevtype_sw"); case d3ddevtype_ref: return text("d3ddevtype_ref"); default: return text("unknown devtype"); } } the obvious solution change tchar* char* keep tchar* if possible. thanks. and yes using unicode character set. then cannot make tchar compatible char. because if you're using ucs, tchar wchar_t. type char not related in way wchar_t . work convert string (using e.g. widechartomultibyte ), you'd lose unicode support.

How to remove ^M (CRLF) from w file sent from Windows to linux FTP server in perl? -

i'm sending comma delimited file (in ascii) via net::ftp in perl (generated on windows) linux based ftp account. issue file on linux side has ^m @ end of each line. know can remove these calling dos2unix" command on file how remove ^m on windows side send correct file in first place. i tried doing below doesn't affect file on linux side. $content =~ s/^m//g; if had "^","m", s/\^m//g work. ("^" special in regex patterns.) if had cr, s/\r\n/\n/g (or s/\r//g) work. if neither work, please provide portion of "od -c" of data file.

rpmbuild - Specifying RPM dependency as "one of the following" -

i developing rpm spec file in-house package. package depends on libuuid , available libuuid package on fedora, there no libuuid package centos 5 in standard rpm repositories. can satisfy dependency on centos e2fsprogs-devel development rpm ( e2fsprogs-devel installs libuuid , associated headers). specify our rpm depends on libuuid , such libuuid package installed on fedora during installation of our rpm, e2fsprogs-devel installed during installation on centos. there way specify dependency "one of libuuid or e2fsprogs-devel, in order" in rpm spec file? no. use dist tag distinguish between fedora , 1 of derivatives.

web applications - Which reverse ajax library for Java? -

what worth @ libraries reverse ajax in java web app? atmopshere still in 0.6 version, icepush still in alpha version, , websockets in firefox 4.0 wont available too. try out comet tomcat . also, tomcat 7 might useful since implements servlet 3.0 spec, believe has niceties reverse ajax async support. here example.

iphone - How to know EXACTLY why a sound starts playing? -

i need play audio clip in mp3 format , synchronize in app audio being played. audio tools in iphone sdk should use allow me know when selected sound starts play? sometimes avaudioplayer notice when sound starts play there slight delay when command player play, , when hear sound (i'm guessing it's loading sound during time). there no 'ready play' delegate methods can find avaudioplayer. any suggestions/pointers appreciated. to accurate synchronization of audio playback, you'll need use audio queue services. it's c interface offering finer-grained control of audio. won't able tell how sync because i've no experience aspect of it, maybe else can help. if @ docs steer in right direction.

Need to speed up MySQL Subquery -

hey have mysql query uses nested subquery. i have tried many ways speed takes 2 seconds run , slowing down webpage. how can speed query? have tried using views , query caching performance benefits nominal. select w.wid, max(wb.blockprice) highestprice, min(wb.blockprice) lowestprice, max(bi.impressions) highestimpressions, min(bi.impressions) lowestimpressions website w join website_block wb on wb.wid = w.wid join website_block_impressions wbi on wbi.wbid = wb.wbid , wbi.statdate > date_sub(now(),interval 1 day) join ( select round((sum(impressions) / count(impdate)) * 30) impressions, wid widimpressions (select count(wbi.wbiid) impressions, cast(wbi.statdate date) impdate, wbi.wbid, wb.wid ...

c# - Permanently cast derived class to base -

class { } class b : { } b itemb = new b(); itema = (a)b; console.writeline(itema.gettype().fullname); is possible above , have compiler print out type instead of type b. basically, possible permanently cast object "loses" derived data? what ask impossible 2 reasons: itema.gettype() not return compile-time type of variable itema - returns run-time type of object referred to itema . there's no way make (a)b result in representation-changing conversion (i.e. new a object) because user-defined conversion operators (your hope here) cannot convert derived base-classes. you're going normal, safe, reference-conversion. that aside, ask strange; 1 think you're trying hard violate liskov's substiution principle. there's serious design-flaw here should address. if still want this; write method manually constructs a b newing a , copying data over. might exist toa() instance-method on b . if characterized problem "how construc...

java - Fast way to get results in hibernate? -

i have hibernate set in project. works things. today needed have query return couple hundred thousand rows table. ~2/3s of total rows in table. problem query taking ~7 minutes. using straight jdbc , executing assumed identical query, takes < 20 seconds. because of assume doing wrong. i'll list code below. detachedcriteria criteria =detachedcriteria.forlass(myobject.class); criteria.add(restrictions.eq("booleanflag", false)); list<myobject> list = gethibernatetemplate().findbycriteria(criteria); any ideas on why slow and/or change it? you have answered own question already, use straight jdbc. hibernate creating @ best instance of object every row, or worse, multiple object instances each row. hibernate has degenerate code generation , instantiation behavior can difficult control, large data sets, , worse if have of caching options enabled. hibernate not suited large results sets, , processing hundreds of thousands of rows as objects ...

xamarin.ios - monotouch Get Image to move around the screen -

simple requirement proving tricky. the sample code below threw example, end goal produce routine makes image bounce on given x co-ordinate. @ moment i'm stuck on getting thing move second time. animation below happens once i.e cannot move , down regardless of , parameters. moves once when loaded, i.e. private void loadgetstarted() { uiimageview imageview = new uiimageview(); uiimage getstartedimage = new uiimage("images/downarrow.gif"); float leftpos = 80f; rectanglef f2 = new rectanglef(leftpos, 130f, 200f, 181f); imageview.image = getstartedimage; imageview.frame = f2; this.add(imageview); animate(imageview,"y",-100f,-200f); animate(imageview,"y",-100f,200f); animate(imageview,"y",10,100f); } private void...