Posts

Showing posts from April, 2014

reporting services - Pivot table with dynamic columns with average? In SSRS? -

i have sql table/query gives me these columns: date testname testvalue i want report gives me this: date test1 test2 test3 3/1/2011 25 22 19 4/1/2011 22 32 12 average 23.5 27 15.5 i can matrix spread test types out... can subtotal. how can average? click on data cell in matrix , right-click , change field expression =avg(fields!testvalue.value) i believe looking for.

swing - Setting the Global Font for a Java Application -

i need set the default font application. there way not laf dependent? figured out: call with: setuifont (new javax.swing.plaf.fontuiresource(new font("ms mincho",font.plain, 12))); private static void setuifont(javax.swing.plaf.fontuiresource f) { java.util.enumeration<object> keys = uimanager.getdefaults().keys(); while (keys.hasmoreelements()) { object key = keys.nextelement(); object value = uimanager.get(key); if (value instanceof javax.swing.plaf.fontuiresource) { uimanager.put(key, f); } } }

c++ - Is there any way to check if pointer is dangling? -

i have code use pointer access datablock. in rare cases, few members of datablock empty, , result pointer becomes dangling. in fact, correct pointer program crashes when trying pointer. the usual advice avoid type of usage. sadly, framework use requires use type of data access methods. is there way can "check" if pointer invalid before doing operation it? checking pointer not equal null did not work, obviously. tried this: try { cstring csclassname = typeid(*pmypointer).name(); // check error condition // line below fails due dangling pointer (data block not valid). hr = pmypointer->mypointermethod(); } catch(bad_typeid) { return e_fail; } catch(...) { return e_fail; } is correct way? i think looking @ wrong direction. have bug not correctly initializing pointers, deleting objects , trying reuse pointer after has been deleted or alike. if case, should focus on determining why happening , fixing bug, rather trying find way of hidin...

sql server - Retrieving column information (composite key) in SQL -

i have large sql database need verify structure of tables , columns (not data itself). need generate list of of tables, each table, of columns, each column, data type, length/precision, ordinal position, , whether it's part of primary key table. i can of need following query: select table_name, ordinal_position, column_name, data_type, character_maximum_length, numeric_precision, numeric_scale information_schema.columns however, i'm not sure how check whether column part of primary key. additionally, tables pk consists of more 1 column, want know ordinal position of each column within key. information i've found far relates setting key rather reading it. i'm interested in doing in both sql server , oracle. in sql server can select k.table_catalog, k.table_name, k.column_name, k.ordinal_position information_schema.key_column_usage k inner join information_schema.table_constraints tc on k.table_catalog = ...

mysql - Should Foreign Keys be used in a structure where multiple options can be selected by a user? If so, how so? -

in mysql, advised store multiple choice options "drugs" separate table user_drug each row 1 of options selected particular user. advised create 3rd table drug describes each option selected in table user_drug . here example: user id name income 1 foo 10000 2 bar 20000 3 baz 30000 drug id name 1 marijuana 2 cocaine 3 heroin user_drug user_id drug_id 1 1 1 2 2 1 2 3 3 3 as can see, table user_drug can contain multiple drugs selected particular user, , table drug tells drug each drug_id referring to. i told foreign key should tie tables user_drug , drug together, i've never dealt foreign key's i'm not sure how that. wouldn't easier rid of drug table , store text value of each drug in user_drug? why or why not? if adding 3rd table drug better, how implement foreign key structure, , how retrieve respective values using foreign keys? (i find far easier use 2 tables...

sql server - Find all sql statements in a xaction which deadlocked from memory dump -

environment: sql server 2008 r2 windows 7 64 bit windbg 64bit what know i can find sql stmts in transactions running server-side profiler trace , stopping there deadlock. , searching transaction id in trace files. brute force method , cannot done on production environment. i know should send memory dump microsoft , analyze it. want find our if there hope solve without private symbols. problem: i create memory dump using extended events in sql server when 2 transactions deadlock ( lock_deadlock event). i manually creating deadlock scenario via management studio. lets 1 of deadlocked xaction has 2 sql statements in it. begin tran update tabl1 ... -- sql stmt 1 go update tabl2 .. -- sql stmt 2 now find thread in memory dump , able find out sql stmt 2 i.e "update tabl2". there anyway can sql stmts thread had executed in xaction i.e. in our case "update tabl1.." ? i want know thread had executed before in same transaction. since xaction n...

html - css styling not rendering properly, possible div issue? -

i'm trying make horizontal menu layout in css. using guide listed here: http://www.devinrolsen.com/pure-css-horizontal-menu/ i've got css file looking this, called navigation.css: .navigation{ width:100%; height:30px; background-color:lightgray; } .navigation ul { margin:0px; padding:0px; } .navigation ul li { display:inline; height:30px; float:left; list-style:none; margin-left:15px; } .navigation li { color:black; text-decoration:none; } .navigation li a:hover { color:black; text-decoration:underline; } .navigation li ul { margin:0px; padding:0px; display:none; } .navigation li:hover ul { display:block; width:160px; } .navigation li li{ list-style:none; display:block; } and in actual php page, have this <div class="navigation"> <ul> <li> <a href="#">something</a> <ul> <li><a href="./hello.php">hello</a></li> ...

Unknown System Variable "no_more_data" at Mysql Stored Procedure -

i'm new using mysql stored procedure. there error can't fix code delimiter $$ create procedure `bankdb`.`charge` () begin declare idcust_val int; declare balance_val float; declare productcd_val varchar(10); declare loop_cntr int default 0; declare num_rows int default 0; declare col_cur cursor select c.cust_id, c.balance, c.product_cd account c; declare continue handler not found set no_more_rows = true; open col_cur; select found_rows() num_rows; read_loop: loop fetch col_cur idcust_val, balance_val, productcd_val; if no_more_rows close col_cur; leave read_loop; end if; if productcd_val == 'sav' || productcd_val == 'cd' if balance_val == 2000 balance_val = balance_val-10; update account set avail_balance = balance_val account_id =idcust_val; end if; end if; if productcd_val == 'chk' || productcd_val == 'sav' || productcd_val == 'mm' || productcd_val == 'cd' balance_val = bal...

Is it possible to overload mixins in sass? -

let have mixin shadow such: @mixin box-shadow($offset, $blur, $color) { -moz-box-shadow: $offset $offset $blur $color; -webkit-box-shadow: $offset $offset $blur $color; box-shadow: $offset $offset $blur $color; } is possible overload mixin like: @mixin box-shadow($offset, $blur) { @include box-shadow($offset, $blur, #999); } or have use different names mixins? you can't overload, typical practice set defaults. /* take color arg, or fall #999 on 2 arg call */ @mixin box-shadow($offset, $blur, $color: #999) { -webkit-box-shadow: $offset $offset $blur $color; -moz-box-shadow: $offset $offset $blur $color; box-shadow: $offset $offset $blur $color; }

ruby on rails - Page not updating when using jquery/ajax -

i'm making web app lets people add courses shopping cart. have cart model has_many lineitems. in cart, have ajaxified button lets people remove individual line items. works fine. here's code that: _line_item.html.erb: <div class="delete_line_item"><%= button_to 'delete', line_item, {:method => :delete, :remote => true} %></div> the line_items controller: def destroy @user = current_user @line_item.destroy @cart = @user.cart respond_to |format| format.html { redirect_to(root_path) } format.js format.xml { head :ok } end end then, destroy.js.erb file, located within views/line_items folder: $("#cart").html("<%= escape_javascript(render(@cart)) %>"); i want similar emptying out cart. this, i'm using update action in carts controller. here corresponding code chunks this: <div class="empty_cart"><%= button_to 'empty cart...

jpa - Migration issue - Kodo/OpenJPA to EclipseLink -

i have environment setup java ee (weblogic 10.0). thus, kodo/openjpa used jpa implementation. reasons want migrate eclipselink. have following issue: entity -- manytomany -- entity b fetchtype.lazy, cascade{} jointable axb foreignkey constraint axb.fk_col -> a.pk if want remove entity a, entry in join column should deleted kodo/openjpa -> deletion successful, sql trace shows, first axb rows deleted eclipselink -> deletion fails, foreign key constraint violation. el tries delete entity first. this in 1 transaction (resource_local). thought was, if within transaction, foreign key constraints may violated? can order of deletions changed in way first join table rows deleted? i use eclipselink 1.1.4 thanks help, soccertrash this issue fixed in later versions of eclipselink. try 2.0, or latest 2.3. otherwise remove target object collection first , call flush.

SQL Query to get only those rows with only 1 value in another column -

Image
i have table this: i need query return projectid's have state=21. i.e want projectid 2 & 5. i not want records projectid 1, 3, 4 & 6, because in case, state equal other numbers reasoning goes in subselect, select projectid's have state = 21 in outer select, retain projectid's have state = 21 using having clause sql statement select projectid table t1 inner join ( select projectid table state = 21 ) t2 on t2.projectid = t1.projectid group projectid having count(*) = 1

testing - Wordpress: How to copy your productive environment to create a test-environment? -

what steps, needed create copy of productive wordpress environment testing purposes, respectively create staging environment? this discussed extensively on wordpress.stackexchange.com @mike schinkel developing migration plugin handles database , url issues. download link in above referenced answer.

php - Table with over 12 million rows running in performance problems -

now table having problems relationship table keyword analysis of websites there 5 columns ( keyword_id , website_id , occurrence , percentage , date ) this allows keyword statistics website on period of time , allows visual graph representation website owner. now problem index 57 unique keywords per website on average. , index 12000 websites everyday , because running performance problems. picture table size growing fast. now have index on keyword_id , website id , occurrence , percentage , date ). each 1 of them has index, still having problems selects. how solve performance problem on mysql php? note: indexes each field , 1 of them combined well. sql query 1: select * table keyword_id = "323242" sql query 2: select * table website_id = "232" sql query 3: select * table keyword_id = "323242" order percentage sql query 4: select * table website_id = "232" order occurence sql query 5: select * table keyword_id = "323242" ...

Date format in java -

possible duplicate: how convert seconds_since_the_beginning_of_this_epoch date format in java..? hi have "1304054138" in ssboetod . want display in "21 apr 2011 11:46:00 ist" format. how can in java code... ? simpledateformat sdf = new simpledateformat("dd mm yyyy hh:mm:ss z") string result = sdf.format(new date(timestamp)); if timestamp string , can obtain long version calling long.parselong(string)

html - What happened with my text shadows in Google Chrome? -

Image
so have simple style here previosly chrome rendered same way ff - this and on sudden on document in chrome , see this not transparent @ shadows=( tham - how fix? my css code : body{padding: 5px;background-color: #fff;font: 100.01% "trebuchet ms",verdana,arial,sans-serif} h1,h2,p{margin: 0 10px} h1,h2{font-size: 250%;color: #fff; text-shadow: 0px 1px 1px #000;} h2{font-size: 120%;} div#nifty{ margin: 0 1%;background: #9bd1fa} b.rtop, b.rbottom{display:block;background: #fff} b.rtop b, b.rbottom b{display:block;height: 1px;overflow: hidden; background: #9bd1fa} b.r1{margin: 0 5px} b.r2{margin: 0 3px} b.r3{margin: 0 2px} b.rtop b.r4, b.rbottom b.r4{margin: 0 1px;height: 2px} p{color: #000;text-shadow: 0px 1px 1px #fff;padding-bottom:0.3em} input[type="button"], .ebutton {width: 150px;padding: 5px 10px;word-wrap: break-word;height: auto;}} ::-moz-selection { background-color: #fbfdfe; color: #ff6c24; text-shadow: 0px 1px 1px #258ffd;} ::selection ...

How to implement Map with default operation in Scala -

class defaultlistmap[a, b <: list[b]] extends hashmap[a, b] { override def default(key: a) = list[b]() } i wan't create map a -> list[b] . in case long -> list[string] when key map doesn't have value create empty list instead of exception being thrown. tried different combinations don't know how make code above pass compiler. thanks in advance. why not use withdefaultvalue(value)? scala> val m = map[int, list[string]]().withdefaultvalue(list()) m: scala.collection.immutable.map[int,list[string]] = map() scala> m(123) res1: list[string] = list()

c# - Tracking multiple processes at same time -

have application (winforms) downloads file user's temporary folder, opens file user see contents, , when file closed, file gets deleted temp folder. application working ok if open let's 1 .pdf , 1 .doc problem appears when trying open 1 .doc if winword process still runing (doesn't matter if opened app or directly user). i'm using following code: _openfileproces = system.diagnostics.process.start(tempfilename); _openfileproces.enableraisingevents = true; _openfileproces.exited += new eventhandler(_openfileproces_exited); and 1 clear temp void _openfileproces_exited(object sender, eventargs e) { string s = ((system.diagnostics.process)sender).startinfo.filename; system.io.file.delete(s); } it seems running process stopping own.. , due stopping delete file or generate error while trying delete file. have suggestion how can open own process? thing not know file type have open (it anything) , i'm counting on windows choose best a...

get current SignalStrengths android -

i want current signal strengths in android device on button click. have written public static int getsignal(context c) { class myphonestatelistener extends phonestatelistener { int signal; @override public void onsignalstrengthschanged(signalstrength signalstrength) { super.onsignalstrengthschanged(signalstrength); signal = signalstrength.getgsmsignalstrength(); } } telephonymanager tel; myphonestatelistener mylistener; mylistener = new myphonestatelistener(); tel = (telephonymanager) c.getsystemservice(context.telephony_service); tel.listen(mylistener, phonestatelistener.listen_signal_strengths); tel.listen(mylistener, phonestatelistener.listen_none); return mylistener.signal; } code returns me 0 please tell me how current signal strengths. code return me 0 of course. onsignalstrengthschanged() not have been called yet. and, stop listening listen_none line, never ...

Passing parameters from a Silverlight application to another XAP files using MEF -

i added test.xap file in silverlight application , loaded xap in silverlight application using mef architecture. can send parameters silverlight application test.xap file ? if please send me working code ... or please share thoughts !!!!

c# - How to Clear() controls without causing a memory leak -

after reading control.clear(); causing memory leaks (verified @ msdn ), wondering if: while (controls.count > 0) controls[0].dispose(); will enough, or have iterate recursively through controls within controls? also, there reason control.clear(); after that? (as saw saying somewhere)? thanks. the posted snippet correct. no clear() required, control.dispose() method removes control controls collection. why works. the less alarming version of loop is: (int ix = controls.count-1; ix >= 0; --ix) controls[ix].dispose(); no need iterate through children of control , dispose them, happens automatically.

pointers - C thread argument -

basic function of program: create number of counters (0), create number of instructions per threads, create struct instructions contain counter*, repetitions , work_fn (increment, decrement etc). program build dynamic structure (already coded up) spawn threads , join. 1 thread can have more 1 instructions. static void* worker_thread(void *arg){ long long *n; pthread_mutex_lock( &lock1 ); n = (long long *) arg; printf("testing: %lld.\n", n); pthread_mutex_unlock( &lock1 ); return null; } //nthreads total number of threads for(int i=0; < nthreads ; i++){ pthread_create( &thread_id[i], null, worker_thread, &i); //problem } for(int i=0; < nthreads ; i++){ pthread_join( thread_id[i], null); } i trying test thread function, firstly create number of threads join them. can't seems pass current thread number [i] in case worker thread function. int n = (int)arg; in worker_thread function. and (void*)i instead of ...

c# - Changing HttpContext.Current.User.Identity.Name after User is logged in -

i'm working on asp mvc application. , wondering if there way of changing httpcontext.current.user.identity.name once user has logged in. i want able allow user change his/her username, , need httpcontext.current.user.identity.name changed once have done that. any great i believe can not this:) it filled during authentication. simpliest solution when user changes username - log him out, , ask login. update it work custom provider. if using standard one, believe can't changed @ all. as alternative solution can try next: when user tries change name: 1. create new user 2. abandon session 3. remove old user 4. change data related user new account 5. log him in once again new user.

form.as_table in django -

form = emailform() return render_to_response('books/send_mail.html', {'email_form': form}) when using form.as_table in template, fields getting rendered in same line : (email: subject: message: ) . how can render these form fields in seperate lines using as_table. dont want use as_p or as_ul, because not have proper alignment. did wrap form in table tags ? you can use form.as_table output table rows (you'll need provide own tags)

how to convert string "dd.MM.yyyy HH:mm:ss.mmm" to the datetime in c# -

i try convert string type "dd.mm.yyyy hh:mm:ss.mmm" datetime using way below: datetime result; string c; tarihsaat[n - 4] = datetime.parseexact(c, "dd.mm.yyyy hh:mm:ss.mmm", cultureinfo.invariantculture); but got formatexception error. how can convert it? thanks.. this should it, can't reuse format string pattern twice ("m" in sample), want use "fff" milliseconds. details on custom date , time format strings check msdn . string c = "15.04.2011 14:32:15.444"; datetime result = datetime.parseexact(c, "dd.mm.yyyy hh:mm:ss.fff", cultureinfo.invariantculture);

javascript - Getting the Screen Pixel coordinates of a Rect element -

i trying screen pixel coordinates of rectangle in svg via java script. when rectangle has been clicked, can figure out width, height, x , y position getbbox(). but these positions original positions. want screen position. for example if manipulate viewbox of whole svg, these getbbox coordinates not more same screen pixels. there function or way coordinates considering current viewbox , pixel size of svg element? demo: http://phrogz.net/svg/screen_location_for_element.xhtml var svg = document.queryselector('svg'); var pt = svg.createsvgpoint(); function screencoordsforrect(rect){ var corners = {}; var matrix = rect.getscreenctm(); pt.x = rect.x.animval.value; pt.y = rect.y.animval.value; corners.nw = pt.matrixtransform(matrix); pt.x += rect.width.animval.value; corners.ne = pt.matrixtransform(matrix); pt.y += rect.height.animval.value; corners.se = pt.matrixtransform(matrix); pt.x -= rect.width.animval.value; corners.sw = pt.matrixtrans...

java - How to set Class value to spring bean property? -

hey, best way set bean's property class value ? regarding xml configuration. bean : public class filterjsonview extends mappingjacksonjsonview { private set<string> filteredattributes; private class clazz; public set<string> getfilteredattributes() { return filteredattributes; } public void setfilteredattributes(set<string> filteredattributes) { this.filteredattributes = filteredattributes; } public class getclazz() { return clazz; } public void setclazz(class clazz) { this.clazz = clazz; } } just inject class name, , spring convert class object you, e.g. <bean class="com.x.y.filterjsonview"> <property name="clazz" value="com.x.y.someclass"/> </bean>

entity framework - EF4 with MVC3 - Do I need The Repository Pattern? -

i have learned of repository , unit of work design patterns , thought implement them in new ef4 mvc3 project, since abstraction good. as add them project, wondering if juice worth proverbial squeeze, given following: it extremely unlikely underlying data access mechanism change ef4. this level of abstraction require more overhead/confusion project , other developers on team. the real benefit see using repository pattern unit testing application. abstracting away data store doesn't seem useful since know datastore won't change, , further, ef4 provides pretty abstraction (i call .addobject() , looks modifying in-memory collection , call .savechanges() provides unit of work pattern). should bother implementing abstraction? feel there must massive benefit missing, doesn't feel need go down route. willing convinced otherwise; can make case? thanks. i recommend reading answer , linked questions . repository popular pattern , makes application nice , cl...

sql - How to insert rows with structure from one table to another table? -

what query in sql server insert rows structure 1 table table? a couple ways select into select field1, field2, ... table1 table2 insert into insert table1 field1, field2, ... select field1, field2, ... table2

php - Preg_replace_all links to markdown format -

we're converting markdown, before used 'in-house' system, both image links , data (e.g. alt) in bracket. for example {image link}[optional alt other data] now moving markdown, (our data stored markdown in database), need convert markdown: so how can turn instances of {link}[optional data] (square brackets not required, {}) markdown equivalent: basically, {http://www.youtube.com/image.gif}[this optional alt] ![alt](http://www.youtube.com/image.gif) i have following far, deal optional [alt data] tag? if (preg_match_all('/\[(.*?)\]/i', $string, $matches, preg_set_order)) { } to deal optional alt attribute should use preg_replace_callback. allows test existence of alt attr , add if necessary. $str = ' image {http://www.youtube.com/image.gif}[this optional alt] image alt attribute {http://www.youtube.com/image.gif} '; echo preg_replace_callback( '~{(http://[^s]+)}(?:\[(.*?)\])?~', function($m){ ...

Why puts function doesn't work with input char from socket in C++? -

this code server running login manager, log file malicious access , print out result of wrong login. chars user , pass come user input using socket. if ((memcmp(user, "admin", strlen("admin")) == 0)) { /*code... */ } else { char msg[600]; strcpy (msg,"login error "); strcat (msg,"user: "); strcat (msg,user); strcat (msg," password: "); strcat (msg,pass); strcat (msg," from: "); strcat (msg, client_ip); puts (msg); logfile->write(msg); return false; } well, problem output both on output console , in logfile. like this: login error user: lol password: asd :��ܔ��p{w� from: 127.0.0.1 why there strange asci chars? how can avoid new line since come user input socket? as multiple people have commented about, snippet of code contains nothing c++ specific, i'm answering if working in plain c. i'm guessing, since use memcmp above, input strings not n...

json - Rails: to_json method not working as expected -

i'm bit stumped on this. have user model. trying convert instances json format. however, it's not returning expect: > u = user.first > u.to_json => "\"#<user:0x104ac7718>\"" instead of returning hash of object's attributes, to_json returning string name of model. ideas?

c# - default(Nullable(type)) vs default(type) -

in c#, there difference between default(nullable<long>) (or default(long?) ) , default(long) ? long example, can other struct type. well yes. default value of nullable or other reference type null while default value long or other value type 0 (and other members set defaults). in case: default(nullable<long>) == null default(long?) == null default(long) == 0l

multithreading - VB.NET: Anonymous function to new thread -

i have code: public sub submit( byval reasonid integer, byval email string, byval message string ) '[argument validation code here] emailcontroller.sendmail(reasonid, email, message) end sub i want spin off in new thread submit() returns right after creating , start thread. in c#, this: new thread(() => { emailcontroller.sendmail(reasonid, email, message) }).start(); how do in vb.net? new thread(sub() emailcontroller.sendmail(reasonid, email, message)).start()

java - Why do I keep getting String out of Range? -

return namestring.substring(namestring.indexof(" ", 0), namestring.lastindexof(" ", 0)); why keep returning error? want return string first occurring space character, last occurring space in string? lastindexof public int lastindexof(string str, int fromindex) returns index within string of last occurrence of specified substring, searching backward starting @ specified index... if no such value exists, -1 returned. get rid of , 0 parameters indexof , lastindexof. when pass fromindex of 0 lastindexof searches backwards start of string find match. when doesn't find 1 returns -1 invalid argument substring. return namestring.substring(namestring.indexof(" "), namestring.lastindexof(" "));

optimization - scala speed when using get() method on hash tables? (are temporary Option() objects generated?) -

i converting code scala. it's code sits in inner loop large amounts of data needs fast, , involves looking keys in hash table , computing probabilities. needs different things depending on whether key found or not. code using "standard" idiom: counts.get(word) match { case none => { worddist.overall_word_probs.get(word) match { case none => (unseen_mass*worddist.globally_unseen_word_prob / worddist.num_unseen_word_types) case some(owprob) => unseen_mass * owprob / overall_unseen_mass } } case some(wordcount) => wordcount.todouble/total_tokens*(1.0 - unseen_mass) } but concerned code of sort going slow because of these temporary some() objects being created , garbage-collected. scala2e book claims smart jvm "might" optimize these away code right thing efficiency-wise, happen using sun's jvm? know? this may happen if enable escape analysis in jvm, enabled with: -xx:+doescapeanal...

servlets - <BEA-101024> Unsupported error status code for error-page in web.xml -

we use weblogic deploy our application , far working fine, encountered following exception , not able proceed application. url seems down time. <bea-101024> unsupported error status code error-page in web.xml. and code in web.xml follows <error-page> <error-code>100</error-code> <location>/jsp/main/http_error.jsp</location> </error-page> any on appreciated, in advance. change or add webapp dtd newer 1 in web.xml. weblogic particularly strict theese. can add error-page handlers. ciaooo edit: how http 100 weblogic ? if memory right status 100 continue , should handled silently (without producing error) <!doctype web-app public "-//sun microsystems, inc.//dtd web application 2.3//en" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <servlet> <servlet-name>loginservlet</servlet-name> <servlet-class>it.bigmike.servlet.loginservlet</servle...

c# - Declaration of control -

i need in math logic issue. let have object can manipulate (move) user. after user moved object object continue moving , decelerate stop. example, when user move object point b total distance of 100pixel in x axis, after user release finger, want let object continue moving , decelerate stop point b point c. so how can calculate new distance of point c if set time decelerate , stop in 2sec? thank you! d = ½at² + v i t + d 0 d 0 point @ user "let go". calculate v i motion before letting go. set negative; you'll have fiddle feel right. increment t 0 through 2. d object end up. remember , v i vectors pointing in opposite directions, , d 0 , d points .

python - How do I create a function that will create a global (and assign it a value) with a name that contains the name of the argument given to it? -

i'm using python , trying create function @ name of object given argument , (among other things) create globals contain name, example: object1=someclass(args,kwds) #the object instance of class given name (e.g.object1) def somefunc(some_argument): global tau_some_argument global ron_some_argument #e.t.c. other variables (i assign variables etc) tau_some_argument=some_value1 ron_some_argument=some_value2 print ron_some_argument print tau_some_argument now want happen if call function follows: when call somefunc(object1) i create globals named tau_object1, ron_object1 , assign them values (the print statements irrelevant), if called somefunc(object2) where object2 instance of class create globals: tau_object2, ron_object2, @ moment function creates globals named tau_some_argument (as obvious code). now read somewhere names of python objects immutable, unless class or function don't know how this, reading feeling may need use meta-classes fe...

java - How to attach XML file in message body of HTTP post request? -

how attach xml file in message body of http post request? can 1 give example kind here sample code snippet making http post request on desired url: try { string myxml = "<? xml version=1.0> <request> <elemtnt> <data id=\"1\">e1203</data> <data id=\"2\">e1204</data> </element> </request>"; httpclient httpclient = new defaulthttpclient(); httpcontext localcontext = new basichttpcontext(); httppost httppost = new httppost("https://www.google.com/calendar/feeds/default/owncalendars/full"); list<namevaluepair> datatopost = new arraylist<namevaluepair>(); datatopost.add(new basicnamevaluepair("yourxml", myxml)); httppost.setentity(new urlencodedformentity(datatopost)); httpresponse response = httpclient.execute(httppost, localcontext); } catch (exception e) { e.printstacktrace(); }

Linking 64bit dll mingw -

i'm linking dll dependencies on other dlls. have trouble linking 64bit version of project. 32bit version ok far use mingw32. when switch 64bit version of dependent dlls , mingw-w64 tells following: c:/.../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible .\lib\native/libblabla.dll when searching -llibblabla where 'libblabla' library depend on. i'm absolutely sure 64bit version , should compatible. bug in mingw? also, tried link using lib file, provided lib considered incompatible , 1 generated dlltool has no import table generated! i'm totally stuck this. thank you. first, possible misunderstanding out of way: gcc/ld can link (properly exporting) 32-bit dlls , .lib / .a import , static libraries. gcc/ld should able link exporting 64-bit dll or .a import or static lib, never 64-bit .lib file. you aren't building/linking -m32 , you? by "properly exporting" mean dumpbin /exports or nm -t reveal exported symbols when ru...

php - In PHPUnit, how do I indicate different with() on successive calls to a mocked method? -

i want call mocked method twice different expected arguments. doesn't work because expects($this->once()) fail on second call. $mock->expects($this->once()) ->method('foo') ->with('somevalue'); $mock->expects($this->once()) ->method('foo') ->with('anothervalue'); $mock->foo('somevalue'); $mock->foo('anothervalue'); i have tried: $mock->expects($this->exactly(2)) ->method('foo') ->with('somevalue'); but how add with() match second call? you need use at() : $mock->expects($this->at(0)) ->method('foo') ->with('somevalue'); $mock->expects($this->at(1)) ->method('foo') ->with('anothervalue'); $mock->foo('somevalue'); $mock->foo('anothervalue'); note indexes passed at() apply across method calls same mock object. if second ...

iphone - How to anchor viewForHeaderInSection views of UITableView to top? -

i need implement table view multiple sections , specifying views viewforheaderinsection . know default behavior when section header view visible , other section's header comes scrolling bottom, first 1 pushed off table view , bottom 1 placed on top. what need anchoring these header views on top of tableview, stacking them under each other. best way this? don't add data particular section. so, display sections in tableview.

python - Drawing mud map -

Image
i'm trying draw map of mud. have used python , graphviz like: http://img23.imageshack.us/img23/5222/arrasz.png as can see have locations , going n/s/w/e/up/down going other location. is possible, graphviz, draw map have north locations south, , east locations on right of west locations? i mean that: some --- e ---> location <--- w --- location 2 . / \ | | | n s | | \ / ` location 3 or maybe there better tool draw automatically graphviz? people have asked improving graphviz layout before, think graphviz overkill here. if have standard mud layout this: ...then you've got strong constraints rooms are. graphviz doesn't know constraints, won't job simple algorithm like: pick st...

pentaho - Is it possible to use Kettle to connect to a paradox 4.5 database? -

i’m new pentaho, , need create transformation reads input paradox tables. we’re using old version of paradox – it’s 4.5. tables need load have .db extension. appreciated. thanks! paradox isn't database understands sql, jdbc drivers won't much. best bet convert paradox database bunch of csv files , load them kettle using "csv file input" step. option open paradox database files microsoft access convert tables access files. can use "microsoft access input" step.

asp.net - Access control from .aspx in .ascx -

i have custom user control made called orderform.ascx . have .aspx file utilizes orderform control. i want access control on .aspx file orderform control. there way this? you use findcontrol method in user control this: label label = page.findcontrol("label1") label; if (label != null) string labeltext = label.text; as note on above, depending on label in page, may need use recursion find label. you create property on page returns text of label: public string labeltext { { return label1.text; } } to access property user control, here 2 options: option #1 string labeltext = ((pagename)page).labeltext; option #2 string labeltext = page.gettype().getproperty("labeltext").getvalue(page, null).tostring();

memory - Looking for something like getrusage() in C++ -

getrusage() can display amount of memory used children of process. creating shell launch several child programs. getrusage() report total sum of memory of these children using, not want. want know how memory each child using. getrusage() looks use except doesn't work individual child processes. can used? maybe fork off children 1 @ time , use getrusage(rusage_children...) find out each child's usage independently. the obvious drawback approach if children need running simultaneously. in case, custom-written intermediary program it. instead of executing children directly, execute program which: forks exec s requested program, perhaps passed command line arguments (program , arguments) in style of nice or time commands the parent executes getrusage() children. since there one, desired result. use mechanism pass information main program, perhaps status file. then that's needed master fork off each of children through intermediary directed run int...

php - Code not Working : Photo Swap using Jquery -

i try page like.it replaces images every 10 seconds,using jquery. i put code below.(source code: http://blog.tremaynechrist.co.uk/post/2011/04/17/photofy-new-animated-photo-swap-plugin-for-jquery.aspx ) <script type="text/javascript"> $(document).ready(function () { var getdata = setinterval(function() { //$('#displaydata').load('anyphpfile.php?randval='+ math.random()); var myoptions = { url:'anyphpfile.php?randval='+ math.random(), success: function(data) { $('#postdiv').html(data); }, error: function(xmlhttprequest, textstatus, errorthrown) { alert(xmlhttprequest); alert(textstatus); alert(errorthrown); } } $("#facesphotowrapper").photofy(myoptions); }, 1000); }); var imagelist = []; ...

c# - Free open source Document Management System .net -

i looking open source .net dms. know in post below there c++ not familiar help. i found post asked in 2009 there might have been progress or additions this? open source document management system in .net? the reason open source able integrate else later on. need desktop based system , not web based. does have experience or additional suggestions. nobody stand-alone document management anymore. it's been rolled under umbrella of enterprise content management (ecm) , , web based these days. i know of no open source .net document management systems in particular, sharepoint used this. in fact, don't know of open source stand-alone document management systems other framework either... edit: http://sensenet.codeplex.com/ seems might have you're looking for, although didn't delve deep enough find out how strong dm features are. edit: as codeplex shutting down, therefore project has been moved following location https://github.com/sensenet/ ...

python - Google App Engine Bulk download -

i downloading data(more 1 gb) datastore using bulk download. suddenly, internet stopped working , download process stopped in middle. want resume stopped. when try, following error file "/users/fyp/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/contents/resources/google_appengine/google/appengine/api/datastore_types.py", line 156, in validatestring (name, value, typename(value))) badargumenterror: kind should string; received 3 (a int): [info ] [workerthread-2] backing off due errors: 1.0 seconds [info ] error occurred. shutting down... [error ] error in workerthread-0: kind should string; received 3 (a int): this code download data appcfg.py download_data --config_file=bulkloader.yaml --batch_size=200 --filename=final80_2.csv --kind=taskstime1 --url=http://abc.appspot.com/_ah/remote_api --rps_limit=40 --db_filename=bulkloader-progress-20110429.141103 --result_db_filename=bulkloader-results-20110429.141103 how solve pro...

android - Layout or image fixing vertically & horizontally -

hi guys m new android, please me info about,how can fix layout different versions of android sdk's. example: m having series of images in app. & every image having same size if have fixed these size of images android sdk 2.2 when run app. in android sdk 3.0 emulator image becomes small it,what want want images automatically resized according sdk versions whether hold vertically or horizontally, app. can me installed on cell phone & don't have stretch images according various sdk's. hope there might solution this.... please me sample code if knows it. in advance guys!! while surfing web found piece of code relating problem ... use if found worthy to auto adjustment of image add following property image view written below for xml android:scaletype="fitxy" for java myimageview.setscaletype(scaletype.fit_xy);

php - FileMaker: integrating with Magento -

i write magento web-app working filemaker database. could overwrite database core files code using filemaker php api? what other options there? i wanted interface between filemaker , magento database cause of eav it's nightmare bind magento database filemaker database. if want need use php in filemaker , use soap api of magento if separated hosted. integrate magento core api php script filemaker api if host magento on same web server or installing new magento instance pointing availalble external database. local replication of mysql database on filemaker server. to integrate magento core api it's easy in php file, set following: <?php require_once 'yourmagentoinstallation/path/app/mage.php'; mage::app('default'); // default can replaced default store code // can use magento code (model, eav, singleton, block, etc) ... ?> it's possible, there different ways didn't find when needed out of box solution.

iphone - Minimum iOS target version that Apple accepts in AppStore? -

i have application ideally run on ios versions, think apple accepts apps version , above (3.0 think, not sure). question be, what's minimum ios target version can send in review (and accepted). if greater ios publishing experience answer question great , maybe point out places can read it. many thanks! sometime last year, apple dts employee posted (and later clarified) on ios developer forums app store no longer accepting apps deployment target lower 3.0. might indicate lower deployment target has or become grounds app rejected. i never set deployment target lower of lowest os version among devices plan use test app before submitting app store. also, installed based of devices haven't been upgraded 3.0 or above might microscopic worth developer's time or effort (unless happen still have , use 1 reason). added in 2013: app store submission requires app support 4" display, requires ios 6.0 or later, allows minimum deployment target no lower ios 4.3...

python - dictionary key-call -

im building test program. database of bugs , bug fixes. may end being entire database time working in python. want create effect of layers using dictionary. here code of april 29 2011: modules=['pass'] syntax={'print':''' in eclipse anthing "print" needs within set of paranthesis''','strret':'anytime need use return action in string, must use triple quotes.'} findinp= input('''where go? dir:''') if findinp=='syntax': print(syntax) dir2= input('choose listing') if dir2=='print'or'print'or'print': print('print' in syntax) now when use entire dictionary, not first layer. how this? need list links in console? or there better way so? thanks, pre.shu. i'm not quite sure want, print content of single key of dictionary index it: syntax['print'] maybe bit: modules=['pass'] syntax...

jQuery validate - User must select YES radio (not no) in order to conitnue -

i set jquery validate rule require yes (not no) checked in order form validate/submit. user must accept terms. if user selects no error msg , form not validate. correct way accomplish using jquery validate plugin? <form id="myform"> <input type="radio" name="terms" id="terms1" value="yes!" class="required" title="must accept terms continue" /> yes <input type="radio" name="terms" id="terms2" value="no" class="required" title="must accept terms continue" /> no </form> $("#myform").validate({ /* insert awesome jquery validation code here. free beer whoever answers question! */ }); here working example: http://jsfiddle.net/thcs8/1/ kudos can provide solution or better example! vote if looking same solution gets attention. all! please vote favorite solution! i had problem, , tried various things includi...

ruby on rails - Clearing out ActionMailer::Base.deliveries after RSpec test -

i have following rspec test usermailer class: require "spec_helper" describe usermailer "should send welcome emails" actionmailer::base.deliveries.should be_empty user = factory(:user) usermailer.welcome_email(user).deliver actionmailer::base.deliveries.should_not be_empty end end this test passed first time, failed second time ran it. after doing little bit of debugging, appears 1st test added item actionmailer::base.deliveries array , item never got cleared out. causes first line in test fail since array not empty. what's best way clear out actionmailer::base.deliveries array after rspec test? since am::base.deliveries array, can initialize empty array. can rid of first check it's empty too: describe usermailer before { actionmailer::base.deliveries = [] } "should send welcome emails" user = factory(:user) usermailer.welcome_email(user).deliver actionmailer::base.deliveries.should_not be_...

Websphere 7 MQueue: how to access queue depth from Java? -

i'd write code monitor queue size on websphere 7 mq. code i've come with mqenvironment.hostname = "10.21.1.19"; mqenvironment.port = 1414; mqenvironment.channel = "system.cdef.svrconn"; mqenvironment.properties.put(mqc.transport_property, mqc.transport_mqseries); mqqueuemanager qmgr = new mqqueuemanager("myqmgr"); mqqueue destqueue = qmgr.accessqueue("publish", mqc.mqoo_inquire); system.out.println(destqueue.getcurrentdepth()); destqueue.close(); qmgr.disconnect(); how know "channel" is? how know queue manager name pass mqqueuemanager? or there api should at? i need work wrs 7 sib , mq. thanks jeff porter i used jars ws 7.0.1.1 com.ibm.mq.jar com.ibm.mq.jmqi.jar com.ibm.mq.jmqi.system.jar com.ibm.mq.commonservices.jar com.ibm.mq.headers..jar com.ibm.mq.jmqi.remote.jar i got queue manager name , channel name "ibm webshpere mq explorer" (client connection node in...

Substitution for HTML -

is there programing language can substitute html in making web sites.i don't mean asp,jsp,php or similar.specifically looking web site programing language not based on line semantics.more specifficaly i' m looking add winforms coordinates possibility(positioning elements based on x , y axes).excuse english,if made error. hope understod question. there isn't. however, css has absolute positioning allow achieve want. css #box { position: absolute; left: 20px; top: 80px } html <div id="box"> absolutely positioned! </div> be advised though it's wrong choice. html fundamentally different forms based systems, it's designed displayed on wide choice of different devices. maybe show issue you're dealing exactly, , ask specifically.

sql - How to access openoffice.org database from command line -

i have database built in openoffice.org base (.odb). open database using command line sql client, such sqlite3 or psql. can tell me how make work? running windows 7 64-bit , have cygwin installed. afaik can't access odb database directly , since it's embedded db instance. can migrate odb "normal" hsqldb database , run in hsqldb server. after that, database accessible using command line clients sqltool . still can access database openoffice base using jdbc, can continue using data openoffice access "from outside". the odb zip file containing standard hsqldb database files, shouldn't hard make available hsqldb directly. there guides , tutorials how proceed: how open ooo database directly hsqldb hypersql openoffice.org ooo forum another ooo forum entry ... , third one

c# - Selectively redirect to https, not all pages -

i have website requires secure pages logging in, user accounts, form submission etc. not need secure on pages. certificate purchased , installed on www.mywebsite.com. i redirecting users https using c# code in page_load: if (!request.islocal && !request.issecureconnection) { string redirecturl = request.url.tostring().replace("http:", "https:"); response.redirect(redirecturl); } my concern after visiting secure page , user clicks on page, stays secure rather going http. i have looked @ number of options including iis rewrite (it's whole other language , complicated) , coding globally (redirects every page, not selective). is there simple solution allow me redirect https on selected pages (about 10 or pages, or pages in particular folder) , http on others? i'm not greatest coder in world, trying find easy implement , understand. if portion of website requires ssl, recommend use ssl throughout. unn...

xcode - How to make a file converter for a Mac? -

i create file converter mac. should use xcode this, , find code make such app. there tutorials making file converters xcode best bet. idea on how make 1 can go github , , public repos. here link repo of http://mirovideoconverter.com/ https://github.com/8planes/mirovideoconverter

css - Google Web Fonts not working after Firefox 7 upgrade -

i have no idea why happening. following standard tried , tested method of using google web fonts <link href='http://fonts.googleapis.com/css?family=sunshiney' rel='stylesheet' type='text/css'> <style> h1{ font-family: 'sunshiney', cursive; } </style> <h1>hi there</h1> this works in safari, chrome , ie not ff7. has come across this. i've tried using js integration , @import syntax , same. i'm stuck. this known issue google web fonts. internal configuration change broke serving of 1 of headers needed reliable operation in firefox , ie9+. fix propagating , should working soon. thanks reporting issue! (i'm engineer on google web fonts team, found in twitter search trying investigate how deep breakage went)

positioning - How can the absolute position change within a relative div (html/css) -

i didn't know how else phrase question, i'll try explain through code <ul> <li><span>1</span><li> <li><span>2</span><li> <li><span>3</span><li> <li><span>4</span><li> </ul> ul{ width:90px} ul li{width:30px; float:left; position:relative;} ul li:hover span{ position:absolute; width:60px;} now, when hover on list one, span cover list 2, , list 2 cover list 3. once hover on third list, span run on ul element. there way make third span expand right left? @ moment spans starting point (as understand it) top-left corner of list. there way make start right. 30px expand left, not right? thanks first,you closed li tag incorrectly.i execute same code yours.but when hovered span nothing happened , regular , correct.i think mean jquery accordian plugin or lick that.maybe can jquery instead of css in issue.if need code comment me.good luck

jquery - image transition -

i using following dynamic code gallery images: <section id="banner"> {pyro:galleries:images slug="template-slider" limit="5"} <img src="{pyro:url:base}uploads/default/files/{name}" alt="{name}"> {/pyro:galleries:images} </section> i create image fade fades between images in div not sure best way go due being dynamic. do id banner , img or img? i used nivo-silder job

Parsing a document , C -

i need parse document in c language. use strtok function don't know if it's best method or if token system enough (searching \n, space etc). the structure of each line of document : element \n element "x". thanks :-) token system if fine, strtok implementation of that. however, you're better off using strtok_r not keep internal state outside control of program.

asp.net - Validation, Page events and ViewState -

i have 2 buttons on page. 1 button responsible text fields validation registration , other loging in. problem when press 1 of buttons refreshes page , shows invalid fields (i dont want registration fields checked requiredfieldvalidator whent user presses login button). so did used initialization event.. prevent happening... static bool onebuttonpressed; protected void page_init(object sender, eventargs e) { if (onebuttonpressed) { registerage.visible = false; registerage2.enabled = false; registerage3.enabled = false; registerpassword.enabled = false; registerpassword2.enabled = false; registeremail.enabled = false; registeremail2.enabled = false; } else { entrypasswordrequiredfieldvalidator10.enabled = false; entrynameentryrequiredfieldvalidator9.enabled = false; } } protected void entry_click(obj...

ssl - "config.force_ssl = true" not forcing HTTPS -

i running rails 3.1 , have tried putting above line in development.rb , application .rb (not both @ same time) doesn't seem anything. request still working on http. isn't meant force requests use https? i'm sure i've missed obvious here can't life of me think of - being newbie doesn't either. any appreciated. cheers, dany. it wont work locally, have deployed it?

data recovery - How can I undelete a file using C#? -

i'm trying find lost .jpg pictures. here's .bat file setup simplified version of situation md testsetup cd testsetup md cd echo "can find later?" > a.abc del a.abc cd.. rd what code needed open text file again? i'm looking .jpeg files treated in similar manner more details: i'm trying recover picture files previous one-touch backup directories , files have been deleted , saved in backup single character name , every file has same 3 letter extension. there current backup need view previous deleted ones (or @ least .jpg files). here's how trying approach it: c# code to best of knowledge, file recovery tools read low-level filesystem format on disk , try piece deleted files. works because, @ least in fat, deleted file still resides in sector specifying directory (just different first character identify "deleted"). new files may overwrite these deleted entries , therefore make file unrecoverable. that's little bit of th...

objective c - Why send a class through +(Class)class before calling a class method? -

i've been browsing sketch, example program ship xcode, , keep seeing things (not though): [[myclass class] classmethod] now, since myclass isn't instance of class, do: [myclass classmethod] as experiment though, able make difference between 2 above statements, overriding + (class)class , returning another class! if ever want this, need former version work, can see there could usage this, there really? it sounds awful idea tampering +class , please enlighten me if there is. thanks! to see examples, check out method -copy: in sktgraphicsview.m in sketch program found in developer/examples/sketch/ . in case cited, don't see reason calling +class . however, there definitely case calling [[self class] dosomething] instead of [[myclass class] dosomething] . in first case, [self class] can return correct result if object has been subclassed. in second case, myclass class object, means mysubclass not override +dosomething class method.

osx - NSMutableURLRequest and memory issue -

good morning, i'm developing application uploads files; there no real issues, 1 big problem: if try upload 1gb of files allocates 1gb of memory, , can understand not thing. here's code: allocate data nsdata , use nsmutableurlrequest + nsurlconnection upload them; question is: there ways without needing allocate whole memory? i've searched out, found nothing... _uploaddatafile nsdata sub-class instance allocated before. nsmutableurlrequest *request = [[[nsmutableurlrequest alloc] initwithurl:[nsurl urlwithstring:@"http://my.server/page"] cachepolicy:nsurlrequestreloadignoringcachedata timeoutinterval:60.0] autorelease]; nsdata *datafile; if (_uploaddatafile == nil) { nserror *error = nil; datafile = [[[nsdata alloc] initwithcontentsoffile:@"pathtofile" options:nsdatareadinguncached error:&error] autorelease]; if ...