Posts

Showing posts from July, 2014

image - Can I add a poster to the audio player? -

i'd add poster audio player previews video mode of mediaelement.js player. i've checked shortcodes , there doesn't seem this. want static image above audio player visible before , during playing. the reason want 'all-in-one' player because wp theme allows me create posts in 'audio' format audio player appears @ top of category view of recent posts. it'd awesome add image each post , have part of audio player. kind of video less overhead. thanks in advance.

switch statement - How do I DRY up this Ruby code? -

here code: when 'jty' if j.type != "0" @color = allcolors.find { |c| c['type'] == j.type.to_s } clr << @color.color if @color else clr << @@default_map_marker_color end when 'jcat' if j.priority != "0" @color = allcolors.find { |c| c['type'] == j.priority.to_s } clr << @color.color if @color else clr << @@default_map_marker_color end i have 6 more when statements in case, , repeat part: clr << @color.color if @color over , over. hate it. here things need know: clr empty array initialize outside case statement, , case statement inside for loop that's going through lot of objects. it's looking color associated particular thing, , nosql-hack-ish way relational data. if like: def push_color clr << @color.color if @color end clr , @color aren't being passed around without params method. there's dislike passing para

c++ - Nested class declaration: template vs non-template outer class -

i have c++ template class has nested class inside, like: template<int d> class outer_t { public: class inner; inner i; }; template<int d> class outer_t<d>::inner { public: float x; }; int main () { outer_t<3> o_t; // 3 or arbitrary int o_t.i.x = 1.0; return 0; } this compiles without problems. however, declare similar non-template class, this: class outer_1 { public: class inner; inner i; }; class outer_1::inner { public: float x; }; int main () { outer_1 o1; o1.i.x = 1.0; return 0; } i start getting following error (i'm using gcc 4.6.3): "error: field ‘i’ has incomplete type". know can remedy defining inner class inline, inside outer class: class outer_2 { public: class inner { public: float x; }; inner i; }; this compile, avoid defining nested class inline. have 2 questions: reason apparently odd discrepancy between template , non-template nested class de

node.js - Using Express 4 how to redirect to my own route without losing req and response data? -

i have application structured 3 routes (api, admin, default). each lives in there own file , has it's own middleware , exports route. problem facing when want forward route lives on different router. want call same function not serving same view multiple locations. i don't want user res.redirect('/someplace') because want able pass req , res objects on method. |-app.js |-routes |---admin.js |---api.js |---default.js the routes required , used in app.js follows app.use('/api', require('./routes/api')(passport); app.use('/admin', require('./routes/admin')(passport); app.use('/', require('./routes/default')(passport); inside of admin if have situation need redirect login , pass data // authenticates routes admin router router.use(function(req, res, next){ if(req.isauthenticated()){ return next(); } res.flashmessage.push('session expired'); //is lost after redirect res.redi

node.js - mongodb aggregation get the total number of matched document -

i have following sample docs saved in mongogb, like: { name: 'andy', age: 19, description: 'aaa aaa aaa' } { name: 'andy', age: 17, description: 'bbb bbb bbb' } { name: 'leo', age: 10, description: 'aaa aaa aaa' } { name: 'andy', age: 17, description: 'ccc ccc ccc' } what pipeline should total number of name in each of matched sets? can use sum number next pipe. pipeline have this: var pip = [ { $match: { name: 'andy' } } ] and want result like { name: 'andy', age: 19, description: 'aaa aaa aaa', total_andy: 3 } { name: 'andy', age: 17, description: 'bbb bbb bbb', total_andy: 3 } { name: 'andy', age: 17, description: 'ccc ccc ccc', total_andy: 3 } i not clear want. , don't have enough reputation ask in comment. let me have shot @ a

hadoop - Flume - Tiering data flows using the Avro Source and Sink -

i'm attempting set simple tiered data flow using avro source/sink between 2 agents on different machines. the first agent on vm-host-01 node (called "agent") has netcat source, memory channel, , avro sink. the second agent on vm-host-02 node (called "collector" has avro source, memory channel, , hdfs sink. here config first agent "agent". agent.sources=s1 agent.channels=c1 agent.sinks=k1 agent.sources.s1.type=netcat agent.sources.s1.channels=c1 agent.sources.s1.bind=vm-host-01 agent.sources.s1.port=12345 agent.channels.c1.type=memory agent.sinks.k1.type=avro agent.sinks.k1.channel=c1 agent.sinks.k1.hostname=vm-host-02 agent.sinks.k1.port=42424 here config second agent "collector" on second machine: collector.sources=av1 collector.channels=c1 collector.sinks=k1 collector.sources.av1.type=avro collector.sources.av1.bind=vm-host-02 collector.sources.av1.port=42424 collector.sources.av1.channels=c1 collector.channels.c1.

javascript - backbone.js: Prevent listener event from firing when model changes -

i have following listener in view when model changed: this.listento(this.model, 'change', this.render); when change model : model.set('foo', bar); is possible make not trigger listener event specific function call? still want event trigger @ other calls. from fine manual : generally speaking, when calling function emits event ( model.set , collection.add , , on...), if you'd prevent event being triggered, may pass {silent: true} option. note rarely , perhaps never, idea. passing through specific flag in options event callback at, , choose ignore, work out better. so if don't want specific set call trigger change event then: model.set('foo', bar, { silent: true }); or tunnel information render using custom option: model.set('foot', bar, { ignore_this: true }); and adjust render : render: function(options) { if(options && options.ignore_this) return; // ... }

javascript - How do I stay DRY with Meteor template helpers function composition? -

i want remain dry templates created amazing composable functions , helpers realize spacebars doesn't play nicely. i have 2 functions both take 2 arguments: func(a,b) in spacebars turns {{func b}} . the goal compute func2(func1(a,b), c) . figured spacebars @ functions , number of arguments each be able understand {{func2 func1 b c}} . doesn't seem case. ideas? there's no such thing number of arguments in javascript. can define function no explicit arguments: var f = function() { return arguments[0] + arguments[1] + arguments[2]; }; and call how many arguments like: f(1,2,3,4,5,6,7,8); since spacebars translated javascript, inherit behavior. there's no simple way achieve want right now, sadly. you'd need more functions. easiest solution define func2reverse , call reversed order of arguments: {{func2reverse c func1 b}}

sql - total of ratings when using letsrate gem -

i'm using letsrate gem ( https://github.com/muratguzel/letsrate ) allows users rate different attributes (called 'dimensions') of model (for eg "car" model can rated on "price" & "speed"). user allowed re-rate dimensions. i display total sum value of ratings ie latest value of "price" plus latest value of "speed". total gets refreshed automatically every time user re-rates of dimensions. after trial & error tried following helper method: @rate_dimension_1 =rate.find_by_rater_id_and_rateable_id_and_dimension(@user.id, @object.id, "speed").stars @rate_dimension_2 = rate.find_by_rater_id_and_rateable_id_and_dimension(@user.id, @object.id, "price").stars total_rating = @rate_dimension_1 + @rate_dimension_2 but feel inefficient may want increase number of dimensions & sure slow way calculate when there many records. store total in db gets updated when of ratings changed. what best way

android - Correct way to remove a DialogFragment: dismiss() or transaction.remove()? -

i still have problem due dialogfragment used on main activity. i using code remove it: fragmenttransaction transaction = getfragmentmanager().begintransaction(); fragment frag = getfragmentmanager().findfragmentbytag("lockdialog"); if(frag != null) { transaction.remove(frag); transaction.commit(); } the problem still getting crashes due fact dialog has duplicates (meaning dialog not removed sometimes). so question is: right way remove dialogfragment or must used fragments ? do have use dismiss() method time?: fragment lockfragment = getfragmentmanager().findfragmentbytag("lockdialog"); //if dialog exist, dismiss if(lockfragment != null && lockfragment instanceof lockdialogfragment) { lockdialogfragment lockdialog = (lockdialogfragment) lockfragment; lockdialog.dismiss(); } this biggest bug on 1 of apps want sure before choosing 1 or other. thanks! edit : realized current problem maybe due fact commits can delayed,

WPF Combobox is blank (data binding) -

i followed simple tutorial comboboxes ( http://www.wpf-tutorial.com/list-controls/combobox-control/ ). here xaml combobox : <combobox name="coursesteach" grid.row="7" grid.column="1" width="150" height="auto" margin="0,24"> <combobox.itemtemplate> <datatemplate> <stackpanel orientation="horizontal"> <textblock text="{binding name}" foreground="black" /> </stackpanel> </datatemplate> </combobox.itemtemplate> </combobox> code behind : public addtrainer() { initializecomponent(); using (model1container context = new model1container()) { foreach (var row in context.courseset) { if (ro

r - for loop depends on all previous iterations -

i'm pretty new r , programming in general. wondering if can me following: have loop in r each iteration depending on previous. have data set 200k rows, loop takes forever execute. there faster way this? here's code: library(data.table) (i in 2:nrow(dt)) { if (dt$price2[i]%in%dt$price2[1:i-1]) { #if price occurred before dt$dummyid[i] = dt$id[max(which(dt$price2[i] == dt$price2[1:i-1]))] #record latest id of price's order if (sum(dt$size[(which(dt$price2[i] == dt$price2[1:i-1]))]) == 0) #if cumulative sum == 0 (excl. current order) {dt$id[i] = i} #means order got cancelled, assign new id else {dt$id[i] = dt$dummyid[i]} #assign latest id } else {dt$id[i] = i} #price never occurred, new id if (dt$id[i]%in%dt$id[1:i-1]) { #if id occurred before if (sum(dt$size[(which(dt$id[i] == dt$id[1:i]))]) == 0) #and cumulative sum == 0 (incl. current order) {dt$arc[i] = "c"} #cancel order else {

php - MySQL - cannot order by value -

so want order values in database highest lowest. thing randomly scramble results, meaning puts 100 below 50 in middle , 1 in top. <?php $con=mysqli_connect("localhost","username","password","table"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } $result = mysqli_query($con,"select * playerdata order gold"); while($row = mysqli_fetch_array($result)) { echo $row['username']; echo " " . $row['gold']; $row['unique_id']; echo "<br>"; } mysqli_close($con); ?> select * playerdata order gold desc

assembly - Using MASM with VS2013 failed (error MSB3721 / exit code 1) -

i tried compile assembly code via visual studio 2013 (update 2) , received following error: c:\program files (x86)\msbuild\microsoft.cpp\v4.0\v120\buildcustomizations\masm.targets(50,5): error msb3721: der befehl "ml.exe /c /nologo /zi /fo"debug\inffas32.obj" /w3 /errorreport:prompt /ta"......\3rdparty\zlib-1.2.8\contrib\masmx86\inffas32.asm"" wurde mit code 1 beendet. (a german vs2013 version, indeed, should no problem question believe) in fact try compile zlib 1.2.8 masm contributions via vs2013. created empty project, did build customization masm, added 2 files (inffas32.asm , match686.asm) zlib package. changed project create static lib , set sub-system windows. received error message above. if try compile compile file manually in vs2013 shell command line working well. the above procedure worked in vs2012 - now, in vs2013 not compiled anymore (even if open vs2012 project). did miss something, or bug in masm customization build?

Are checksums unique? -

checksums, know, small amount of data computed larger set of data (usually provide error detection). how unique if there's less data? if they're not unique multiple inputs would, definition, produce same checksum, , think defeat whole purpose.

java - Spring BeanCreationException due to NoSuchMethodError in Property class -

i trying start server side of application, built maven; clean install succesful, tomcat7:run fails following spring error message 04:21:19,059 [localhost-startstop-1] error org.springframework.web.context.contextloader - context initialization failed org.springframework.beans.factory.beancreationexception: error creating bean name 'properties' defined in class path resource [context.xml]: initialization of bean failed; nested exception java.lang.nosuchmethoderror: org.springframework.core.convert.property.<init>(ljava/lang/class;ljava/lang/reflect/method; ljava/lang/reflect/method;ljava/lang/string;)v the concerned bean definition in context.xml follows <bean id="properties" class="org.springframework.beans.factory.config.propertyplaceholderconfigurer"> <property name="location" value="classpath:server.properties"/> <property name="ignoreunresolvableplaceholders" value="true"/&

html - Background image z-index issue with image element -

Image
i wanna make overlay background image image. code here . how can put background image on img element? my html is; <div id="sidebar"> <div class="editor-select"> <img src="http://i.imgur.com/mh3noqh.jpg" alt="img"/> </div> </div> my css is; #sidebar{ width: 344px; background: url("http://i.imgur.com/bqc7nyp.png") no-repeat top right !important; float: left; height: 500px; margin-top: 45px; padding: 8px; position: relative; z-index: 1000; } .editor-select{ width: 350px; height: 360px; position: relative; } .editor-select>img{ width: 320px; height: 160px; z-index : -1; } you can't. img element contained within #sidebar element, makes img element on top of #sidebar element. cannot position parent element on top of child. pure css solution what can do, however, use pseudo-element ( :before or :after ), p

algorithm - What is the n in big-O notation? -

the question rather simple, can't find enough answer. on the upvoted question regarding big-o notation , says that: for example, sorting algorithms typically compared based on comparison operations (comparing 2 nodes determine relative ordering). now let's consider simple bubble sort algorithm: for (int = arr.length - 1; > 0; i--) { (int j = 0; j < i; j++) { if (arr[j] > arr[j+1]) { switchplaces(...) } } } i know worst case o(n²) , best case o(n) , n exactly? if attempt sort sorted algorithm (best case), end doing nothing, why still o(n) ? looping through 2 for-loops still, if should o(n²) . n can't number of comparison operations, because still compare elements, right? n size of input. array, number of elements. to see different cases, need change algorithm: for (int = arr.length - 1; > 0 ; i--) { boolean swapped = false; (int j = 0; j<i; j++) { if (arr[j] > arr[j+1]) {

arrays - Use ArrayList to get value without using zero as first value - Java -

i need fix this.. calling array number, although next value in array because first 1 zero. i using arraylist. there way call index value - 1 perhaps ? here example: for (int = 0; < questions.size(); i++) { output.write(string.valueof(page_words.get(questions.get(i-1)))); system.out.println(page_words.get(questions.get(i))); } see i-1, there way works? no can't generate exception . arraylist.get(int i) method of array list can take argument >=0 and<size() negative value generate indexoutofboundsexception . so arraylistindex < 0 or arraylistindex >= size() indexoutofboundsexception generated.

gem - no such file to load -- rcov/rcovtask issue in ruby 1.8.7 -

i have setup existing project first time in system ruby 1.8.7 , rails 2.3.8 when try install gems using rake gems:install i error no such file load -- rcov/rcovtask what actual problem dont know have 1 idea? run: gem install rcov then you'll go.

matlab - Adding vectors with sequential names to a table using a for-loop -

i have vectors (each 1 row , 13 columns) named sequentially (values.val0001, values.val0002, etc.), trying input of these vectors rows in 1 table using follwing code: for = 1:50; j = sprintf('%04d', i); m = []; m =[m; values.(['val' j])]; end the above code produce table first row (i.e. values.val0001) , wouldnt input sequentialy named vectors (i.e. values.val0002, values.val0003) subsequent rows intend. you should move row m = [] out of loop, otherwise reset variable m each time

java - About the references and values in OOP -

in program, variables "r" or "m" of circle_b points variables of object circle_a or have values (no point object) ?? class circle { public int r; public int m; public circle(r, m) { this.r = r; this.m = m; } public getr() {return r;} } main: circle circle_a = new circle(10, 20); circle circle_b = new circle(circle_a.getr(), circle_a.m); edited: class myclass {integer var;} myclass = new myclass(); a.var = 5; myclass b = new myclass(); b.var = a.var; b.var points a.var or has selfvalue (b.var = 5)? these variables int , primitives, they're stored values, see doc

SVG angular gradient -

is there way 'angular gradient' in svg? (i don't know official term -- it's kind of gradient see in color-pickers, varies angle.) svg seems support linear , radial gradients, i'm thinking there might way use transform simulate want. thanks! there's no standard support angular (conical) gradients. but see http://wiki.inkscape.org/wiki/index.php/advanced_gradients#conical_gradient approximation methods (source code not included, though). examples on link not work.

Joomla 3 module to show latest weblinks -

i've copied purpose mod_articles_latest, , changed naming 'articles' 'weblinks' etc. module works, except 1 issue. module shows latest weblinks categories, , when want make selection 1 or more categories, continues display weblinks categories. tried changes in helper.php around code: // category filter $model->setstate('filter.category_id', $params->get('catid', array())); but didn't succeed. have idea? you should not change in source far code goes. undo did , create new language files. should change language strings not code. language string this: jtext::_("module_name_something");

Grails - Limit an IP Address' Upload Rate -

i creating grails application , i'm trying figure out best way prevent user spamming posts on server. have infinite number of forms can leave comments. don't want them have ability send million comments. know there exists way mock "server lag" data rate slows down. within grails framework, there way set maximum post size limit/rate? i tried looking possibility of setting via tomcat properties wasn't having luck there own research. thanks much!!! if understand question correctly, want restrict size of post provided user. if yes, can add maxsize constraint in domain class (or command object if used). if looking prevent form re-submission can use formtokens prevent duplicate submission.

taxonomy - Creating pre-defined taxonomies in WordPress -

Image
i’m creating wordpress plugin, in turn creates custom post type mma fighters. want organise fighters weight class, though use of custom taxonomy. i’ve created weight class taxonomy this: <?php register_taxonomy('mma_weight_class', 'mma_fighter', array( 'hierarchical' => false, 'label' => __('weight class'), 'query_var' => true, 'rewrite' => true )); however, doesn’t seem yield quite want. when go add/edit fighter post, there’s weight class panel displays following: what i’d instead weight class panel that, options (i.e. lightweight, middleweight, heavyweight etc) predefined plugin , displayed drop-down list, rather open input above user can add ol’ option. is possible create pre-defined options taxonomy this? update so, found wp_insert_term() function, programmatically added weight classes, , changed hierarchical true in taxonomy definition. gets me closer want, have this:

Null Pointer Exception when running selenium webdriver testcase using internet explorer driver -

below code: package mypackage; import java.io.file; import org.openqa.selenium.by; import org.openqa.selenium.webdriver; import org.openqa.selenium.ie.internetexplorerdriver; public class myclass { public static webdriver driver; public static file file; public static void main (string[] args){ // declaration , instantiation of objects/variables file = new file("c:\\data\\iedriverserver_x64_2.42.0\\iedriverserver.exe"); system.setproperty("webdriver.ie.driver", file.getabsolutepath()); driver = new internetexplorerdriver(); string baseurl = "http://www.google.com"; string expectedtitle = "google"; string actualtitle = ""; // launch ie , direct base url driver.get(baseurl); // actual value of title actualtitle = driver.gettitle(); /* * compare actual title of page witht expected 1 , print * result "passed" or "failed" */ if (actualt

xcode - Change UILabel from appDelegate -

i want stuff appdelegate in xcode. 1 of these things change uilabel. viewcontroller *viewcontroller = [[uistoryboard storyboardwithname:@"main_iphone" bundle:nil] instantiateviewcontrollerwithidentifier:@"id"]; viewcontroller.label.text = @"heeej"; i told trick. doesn't work. label doesn't change. know problem is? there several problems: don't in appdelegate except loading window initial view controllers (if needed). you instantiating new view controller in first line. assume have view controller , want change label in view controller. need reference view controller , use reference send messages it. the label should not property of view controller. should try follow design pattern model-view-controller or pattern model-view-viewmodel. ask preferred search engine if don't know. id identifier in objective-c bad idea because used object type. edit: don't need reference change property in view controller

css - How to display HTML <FORM> as inline element next to images? -

Image
i have images, 1 of them being able submit hidden form. my problem need images display inline each other. image form submit refuses this. the code, basically, this: <img class="inline" src="image.png" /> <img class="inline" src="image2.png" /> <img class="inline" src="image3.png" /> <form action="/forms/important-form.php" method="post"> <input type="hidden" name="infoforform" value="information"> <input type="hidden" name="url" value="/employee-xyz76r3-headshot.png"> <input type="hidden" name="employeetitle" value="salesperson" > <input type="image" class="inline" src="email.png" alt="submit form" /> </form> css this: .inline { display: inline!important; float: right; } definitely not working t

twitter bootstrap - Bootstrap4Xpages Forms: Layout in 'read mode' not aligned -

Image
i'm using domino 9.0.1 , have managed install correctly bootstrap library 1.0.0.201403171254. i trying use bootstrap form application (a simple crud edit , delete). have inspired myself code 'form' xpage in bootstrap4xpages-demos database. as far can tell, there controls have been 'bootstrapified' , others have surround xpages tag div bootstrap class you're looking - , not sure documented (if @ all). the issue have 'form' doesn't align nicely when in read mode but when in edit mode is there attribute not setting right (i've posted part of code below) or bootstrap4xpages never designed in mind (i.e. have separate versions of markup 'read' mode , 'edit' mode)? i'm suspecting stuck in notes client development mode of thinking, i.e. read mode, edit mode, old ideas ui, if have better alternative please tell me! <?xml version="1.0" encoding="utf-8"?> <xp:view xmlns:xp="http://w

zend framework - Output size in procedure in oracle -

i have procedure: create or replace procedure wypiszzamienniki (z_bloz12 in number ,output out varchar2) lv_test_cur sys_refcursor; begin if (z_bloz12 not null) cur_var in (select p.* produkt p join produkt p2 on p.nazwa_miedz = p2.nazwa_miedz , (p.dawka_l_p p2.dawka_l_p or p.dawka_l_p null , p2.dawka_l_p null) , (p.dawka_j_p = p2.dawka_j_p or p.dawka_j_p null , p2.dawka_j_p null) , (p.dawka_l_n = p2.dawka_l_n or p.dawka_l_n null , p2.dawka_l_n null) , (p.dawka_j_n = p2.dawka_j_n or p.dawka_j_n null , p2.dawka_j_n null) p.bloz12 != z_bloz12 , p2.bloz12 = z_bloz12) loop output := output ||cur_var.nazwa || ' ' || cur_var.opakowanie || ' ' || cur_var.podmiot_odp; dbms_output.put_line(cur_var.nazwa || ' ' || cur_var.opakowanie || ' ' || cur_var.podmiot_odp); end loop; end if; end wypiszzamienn

ios - add a delay to my NSTimer after i press start game -

on button start game have few nstimers make things scroll, want add delay these timers, not sure how though. any advice? here's buttons 1 of nstimers -(ibaction)startgame:(id)sender{ startgame.hidden = yes; backgroundmovement = [nstimer scheduledtimerwithtimeinterval:0.06 target:self selector:@selector(backgroundmoving) userinfo:nil repeats:yes]; } thank you when call [nstimer scheduledtimerwithtimeinterval:...] time interval is delay. called after time interval specify. alternatively, call performselector:withobject:afterdelay: . however, note please there deep flaws in proposed architecture. repeating timer .06 interval terrible idea, , more 1 atrocious idea. need rethink completely. consider using real animation, or display link, or sprite kit. or something. anything, really.

static - C++: Singleton? How to pass arguments to the construtors? -

i reading item 47 in "effective c++". in book suggested called non-local static objects should used special care. instead suggests use below: directory& tempdir() { static directory td; return td; } i not sure if should called singleton. however, thinking how can pass arguments constructor of class directory. instance, want pass path string directory td, perhaps need this: directory& tempdir(std::string & str) { static directory td(str); return td; } the problem whenever want access directory td, have pass string input argument. not beautiful. does have more elegant way of doing this? thank you. does have more elegant way of doing this? instead of passing path in function, write global function "generates" path: char const* get_path() { // do_stuff , return path } directory& tempdir() { static directory td(get_path()); return td; }

Java Code - Comparing last 4 letters -

implement method returns true if final 4 character substrings of s1 , s2 equal. if length of either string less 4, method should return false. you may use method s.substring(n, m) yields substring of s beginning @ index n , ending @ index m-1 . as answer delivered following code, wondering whether did in correct way: public static boolean comparelast4 (string s1, string s2) { s1len = s1.length; s2len = s2.length; if (s1lan < 4 || s2len < 4) return false; (int = 0; < s1len; i++) if (s1.substring() - 4.equals(s2.length() - 4)) return true; return false; } i'd like: public static boolean comparelast4 (string s1, string s2) { if (s1.length() < 4 || s2.length() < 4) return false; return s1.substring(s1.length() - 4).equals(s2.substring(s2.length()-4)); }

c# - Sending an anonymous email to my own address -

i want send anonymous email own gmail/hotmail/yahoo/any other mail service address (im not trying spam or that). why? have .net application , want add "send log developer" feature (attaching log) using smtpclient. fact i've read 30+ pages, , found out, i.e. gmail's smtp client doesn't allow anonymous connections, , many other things. the idea receive mail message this: from: logs@myapp.com (non-existent email really) to: myrealaddress@somedomain.com (this real address recieve logs attachments) subject: issue report nºx (auto-generated) body: textbox attachments: logs attached is possible? if so, how achieve it? the short answer can't reliably achieve this. can work in cases, not all. most email servers these days have spam filters , rules checking on emails, , in cases empty 'from' address result in special treatment. means higher spam score receiving mail server, in cases empty 'from' address result in email being

php - dynamically distribute values into 3 tags -

i have programming problem now. trying dynamically allocate value 3 input tags. basic idea sum of 3 inputs should not exceed value given. so code this <!doctype html> <html> <head> <script type="text/javascript" src="../../jquery/jquery-1.11.0.min.js"></script> <script type="text/javascript"> var total = parseint($('#quantityrequired').text()), inputs = $('input[type="number"]'); inputs .attr('max', total) .change(function() { //make sure current value in range if($(this).val() > parseint($(this).attr('max'))) { $(this).val($(this).attr('max')); } else if ($(this).val() < parseint($(this).attr('min'))) { $(this).val($(this).attr('min')); } //get available total var current = available(); //now update

php - Custom accordion pannel not working properly -

i have accordion script: $(document).ready(function(){ $(function(){ // accordion panels $(".accordion span").hide(); $(".accordion li").click(function(){ $(this).next(".pane").slidetoggle("fast").siblings(".pane:visible").slideup("fast"); }); }); }); and php script: echo "<u>organizational chart</u><br/>"; echo "<div class='accordion'>"; $select_branch=mysql_query("select * branch"); while($result_branch=mysql_fetch_array($select_branch)){ $branch1=$result_branch[1]; if($branch1!='top'){ echo "<li>".$branch1."</li>"; echo "<div class='pane'>"; } $select_department=mysql_query("select * departments"); while($result_department=mysql_fetch_array($select_department)){ $department=$result_department[1];

how can get database name in wordpress? -

Image
i want wordpress database name. have try database name $wpdb failed. when print $wpdb give object array don't know how database name object array. you can anywhere db name using <?php echo db_name; ?> <?php echo db_user; ?> or to db name using $wpdb: global $wpdb; echo $wpdb->dbname; it return database name string.

NSIS sql server installation error -

i installing sql server via nsis. while connecting sql sqlconnection object in c# gives me error "network related or instance specific error..." i using following code. need create named instance sqlexpress2 execwait '"$instdir\sqlexpress2\sqlexprwt_x64_enu.exe" /q /action=install /features=sql,ssms /instancename=sqlexpress2/iacceptsqlserverlicenseterms="true" /enableranu=1 /addcurrentuserassqladmin="true" /sqlsvcaccount="nt authority\system" /sqlsysadminaccounts="" /agtsvcaccount="nt authority\system" /skiprules=rebootrequiredcheck' and notices in sql configuration manager remote procedure call fails , named pipe , tcp ip protocols disabled. i have installed sql express 2014 sp1 silent installation using nsis script works successfully. function installsql execwait '"$temp\sqlexpradv_x64_enu.exe" /q /action=install /skiprules=rebootrequiredcheck /iacceptsqlserverlicenset

Get iPhone's contacts list in Objective-C -

i'd iphone's contacts list without using ios navigation picker . here's code wrote...but it's not working, know why? abaddressbookref addressbook = abaddressbookcreatewithoptions(null, null); cfarrayref allpeopleref = abaddressbookcopyarrayofallpeopleinsourcewithsortordering(addressbook, nil, kabpersonsortbyfirstname); cfindex npeople = abaddressbookgetpersoncount(addressbook); for(int i=0; i<npeople; i++){ abrecordref ref = cfarraygetvalueatindex(allpeopleref, ); cfstringref tmpstringref = abrecordcopyvalue(ref, kabpersonfirstnameproperty); nslog(@"firstname: %@", (__bridge nsstring *)tmpstringref); cfrelease(tmpstringref); } cfrelease(allpeopleref); cfrelease(addressbook);

javascript - upon entering/leaving the page append a string in the url. Is this possible? -

is there way append string in url upon leaving/entering? say default url www.foo.com then upon entering/leaving, becomes www.foo.com?param=1 without clicking something? just using javascript. any appreciated. thanks! here 1 possible method that. using jquery, , adds parameter on page entry (on page leave, it's kind of pointless; also, trigger on addition first case well) - <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> <script> $( window ).load(function() { if (! window.location.href.contains("param=0")) { window.location.href = window.location.href+"?param=0"; } }); </script>

web services - Different date format in Rest WS response in java -

i have 2 soap , rest webservices both has field called createddate. getting date db , setting date field of java class. there 2 different output object each service. when access these services soap ui, getting different format of time. from soap: 2014-06-02t03:05:34-05:00 rest: 2014-06-02t08:05:34z both same time coming same db cell. format different. using cxf both ws spring. want both in first format. thanks but format different. not really. they're both using date/time format in rfc 3339 / iso-8601 , per w3c xml schema recommendation , expresses offset utc local date/time. z used utc offset of 0. those different values in terms of time zone offset, represent same instant in time. 1 representation expresses in utc, in time zone 5 hours behind utc @ instant. (contrary terminology used in various standards, "-05:00" doesn't identify time zone; only shows offset utc @ instant. "real" time zone function utc instant local time @ in

Install R package: UScensus2010blk for windows -

did tried install r package: uscensus2010blk on own pc? i tried use uscensus2010: install.blk ("windows") it gives error saying "not available yet" i downloaded package myself (4.2gb!) , tried install local , still error messages: installing source package 'uscensus2010blk' ... ** data warning in file.copy(files, is, true) : problem copying data\montana.blk10.rda q:\lcvdj\r\r-3.0.2\library\uscensus2010blk\data\montana.blk10.rda: invalid argument ... (the error message repeats different states) ... ** error in lazyloaddbinsertlistelement(from, i, datafile, ascii, compress, : write failed error: installing rd objects failed package 'uscensus2010blk' * removing 'q:/lcvdj/r/r-3.0.2/library/uscensus2010blk' warning in install.packages : running command '"q:/lcvdj/r/r-30~1.2/bin/i386/r" cmd install -l "q:\lcvdj\r\r-3.0.2\library" "c:/users/n1304/downloads/uscensus2010blk_1.00.tar.gz"

Magento email bouncing back as no email address -

i have 'guest' checkout option on magento store, whenever complete transaction "order confirmation" email sends out being returned. obviously email address being saved in onepage checkout (otherwise inline validation display errors). on sales_flat_order table can see following columns null after order has been placed: customer_email, customer_firstname, customer_lastname the odd thing on vagrant box (which should near enough identical) 3 columns above have values in them when go through exact same process. i cannot sure happening, in nutshell seem customer_email whatever reason isn't saved sales_flat_order table & in turn causing email return undelivered. can point me in right direction of logic 'order confirmation' email can found within magento system? order.php app/code/core/mage/sales/model/ app/code/local/mage/sales/model/ , create function getcustomeremail() , code function pubic function getcustomeremail(){

unix - Removing every character in .txt that isn't enclosed by pipes ( | ) OR where the line starts with # -

i've got bunch of .txt files this: # title: got stripes # artist: johnny cash # metre: 4/4 # tonic: db 0.000000000 silence 0.348299319 a, intro, | cb:maj | db:maj | db:maj |, (guitar) 3.931269841 b, verse, | db:maj | db:maj | ab:maj | ab:maj |, (voice 8.662993197 | ab:maj | ab:maj | db:maj | db:maj | # tonic: eb 78.145873015 d, modulation, | eb:maj | eb:maj |, (guitar) 80.474625850 b, verse, | eb:maj | eb:maj | bb:maj | bb:maj |, (voice 85.104784580 | bb:maj | bb:maj | eb:maj | eb:maj | and need convert them this: # title: got stripes # artist: johnny cash # metre: 4/4 # tonic: db | cb:maj | db:maj | db:maj | | db:maj | db:maj | ab:maj | ab:maj | | ab:maj | ab:maj | db:maj | db:maj | # tonic: eb | eb:maj | eb:maj | | eb:maj | eb:maj | bb:maj | bb:maj | | bb:maj | bb:maj | eb:maj | eb:maj | specifically, means: every line starts # needs stay same every blank line (such line 5 in mock example) need

php - Read current URL or URL variable in joomla -

this question has answer here: how full url of article it's id in joomla? 4 answers i'm using joomla 2.5. i'm trying read url variable or full url in joomla component customization. i'm able read url like: http://xyz/index.php?option=com_xyz&format=raw&tmpl=component&lang=en but read url on browser ( with alias ): http://xyz/en/feedback?id=123456&email=abc@hotmail.com feedback joomla alias. i'm redirecting url variable php script. if try: $_server['http_referer']; // not working in ie. $_server['query_string'] //return com_xyz&format=raw&tmpl=component&lang=en jrequest::getvar('email'); // return null works if try getvar('lang'); is there other solution or better way? try using following. might you're looking for: $url = juri::current(); echo $url; us

javascript - JQuery On Click -

i can' quite figure out how attach jquery function div. now, want able click div, , have jquery pop , tell me clicked. of now, nothing happens when click div. <div id="yahoologin" name="yahoologin"> <input type="submit" value="" name="submit" /> </div> my jquery in separate file: $('#yahoologin').on('click',(function() { alert("you clicked it!"); }); does jquery need in same file? when run this: $(document).ready(function () { alert("hi"); }); it works, know i'm linking right page. click function should inside ready function $(document).ready(function () { $('#yahoologin').on('click',(function() { alert("you clicked it!"); }); });

python - Setting an appindicator's tooltip in pygtk -

Image
i've built appindicator menu using following code: self.ind = appindicator.indicator("my-indicator", "indicator-messages", appindicator.category_application_status) self.ind.set_status(appindicator.status_active) self.ind.set_attention_icon("icon1.png") self.ind.set_icon("icon2.png") self.menu = gtk.menu() item = gtk.menuitem("foo bar") item.show() self.menu.append(item) self.menu.show() self.ind.set_menu(self.menu) i want add tooltip shows when user hovers on icon. think gtk.tooltip right thing, appindicator documentation sparse. how attach tooltip appindicator? ultimately looking sort of behavior: appindicator not provide tooltips design. https://bugs.launchpad.net/indicator-application/+bug/527458

swift - Automatic Type Conversion with extension: What is happening here? -

i'm going through first chapter of the swift programming language book , i'm @ part it's describing extension keyword. i had go @ "experiment": “write extension double type adds absolutevalue property.” i got working this: extension double { var absolutevalue: double { if(self < 0) { return self * -1 } return self } } (-10.5).absolutevalue // 10.5 but seems work integers: (-4).absolutevalue // 4.0 what happening here? compiler changing type int double because sees there absolutevalue extension on double not int ? this appears case because if add extension of same name on int so: extension int { var absolutevalue: int { return 42 } } that overrides extension on double . , (-4).absolutevalue returns 42 is there way add extension only works on double s not int s? edit: looks it's doing conversion @ compile-time , since didn't define type liter

sequence - Indexing lists in python, for a range of values -

to knowledge, indexing -1 bring last item in list e.g. list = 'abcdefg' list[-1] 'g' but when asking sequence list, -1 gives second last term in list, list[3:-1] 'def' why? have expected, , defg it because stop (second) argument of slice notation exclusive, not inclusive. so, [3:-1] telling python index 3 to, not including, index -1 . to want, use [3:] : >>> list = 'abcdefg' >>> list[3:] 'defg' >>> >>> list[3:len(list)] # equivalent doing: list[3:] 'defg' >>> also, note future: considered bad practice use list variable name. doing overshadows built-in .

actionscript 3 - Using local variables in global scope after exiting function -

i understand as3 works in following way var str1:string = "global"; function scopetest () { var str1:string = "local"; trace(str1); // local } scopetest(); trace(str1); // global how can make work this? see last line var str1:string = "global"; function scopetest () { var str1:string = "local"; trace(str1); // local } scopetest(); trace(str1); // local var str1:string = "global"; function scopetest () { //use global variable here str1 = "local"; trace(str1); // local } scopetest(); trace(str1); // local or use this var str1:string = "global"; function scopetest () { //use "this" keyword this.str1 = "local"; var str1:string = "local"; trace(str1); // local } scopetest(); trace(str1); // local full sample code: <?xml version="1.0" encoding="utf-8"?> <s:applicatio

oauth 2.0 - Sign In with Google/Facebook/Twitter -

i creating web application on allowing user sign in using facebook/google/twitter. once user sign in store respective ids facebook/google/twitter database table. now database table using same field social_id store ids three(facebook/google/twitter). today had thought if there case of same/duplicate id these providers. so if experienced in using 3 user sign in. could please share info. regards, raj try query: $sql= "insert social_users (social_id, data) values ('$social_id', '$data') on duplicate key update id = id"; the "social_id" field in database must unique.

javascript - Magento - AJAX newsletter validate e-mails that already exist in the database -

i'm using ajax validation doesn't validate if e-mail exists in database. goes through if entered valid e-mail address: onsubmit="if(newslettersubscriberformdetail.validator.validate()) { new ajax.updater({success:'newsletter-validate-detail'}, 'newsletter/subscriber/new', { asynchronous:true, evalscripts:false, oncomplete:function(request, json) { element.hide('newsletter-validate-detail');element.show('pop-confirm'); }, onloading:function(request, json){}, parameters:form.serialize(this) }); } return false;" i have tried modify onsubmit function, no avail. hope here can teach me how make validation work check if entered e-mail exists. this standard magento behavior. doesn't check if email exists , says "thank subscription". you can check in mage_newsletter_subscribercontroller in newaction it'll check existing email if you're logged in , try

php - Join array with a comma every two elements -

i have array $str = $query->get_title(); //red blue yellow dog cat fish mountain $arr = explode(" ",$str); //output of $arr array ( [0] => red [1] => blue [2] => yellow [3] => dog [4] => cat [5] => fish [6] => mountain ) now want join above array , every 2 words. expected result below $result = "red blue, yellow dog, cat fish, mountain"; how can that? please try this, uses array_chuck, explode, , implode. <?php $str = "red blue yellow dog cat fish mountain"; $result = implode(', ', array_map(function($arr) { return implode(' ', $arr); }, array_chunk(explode(' ', $str), 2))); echo $result; output : red blue, yellow dog, cat fish, mountain another method using forloop if don't nested methods. <?php $str = "red blue yellow dog cat fish mountain"; $words = explode(' ', $str); foreach ($words $index => &

c++ - Unsucessfully trying FLTK with code blocks IDE, getting few errors -

i new fltk, comfortable using code blocks ide. have been trying since last 1 week use fltk code blocks. yesterday came across site: http://codeblocks.codecutter.org/ where have portable pre-configured package download, after downloading have tried compile fltk getting few errors. errors messages follow: ||=== fltk, debug ===| c:\program files\codeblocks-ep\sdk\fltk\lib \libfltk.a(fl_printer.o):fl_printer.cxx|| undefined reference `printdlga@4'| c:\program files\codeblocks-ep\sdk\fltk\lib\libfltk.a(fl_printer.o):fl_printer.cxx|| undefined reference `commdlgextendederror@0'| c:\program files\codeblocks-ep\sdk\fltk\lib\libfltk.a(fl_native_file_chooser.o):fl_native_file_chooser.cxx|| undefined reference `getopenfilenamew@4'| c:\program files\codeblocks-ep\sdk\fltk\lib\libfltk.a(fl_native_file_chooser.o):fl_native_file_chooser.cxx|| undefined reference `commdlgextendederror@0'| c:\program files\codeblocks-ep\sdk\fltk\lib\libfltk.a(fl_native_file

python - Can I control the way the CountVectorizer vectorizes the corpus in scikit learn? -

i working countvectorizer scikit learn, , i'm possibly attempting things object not made for...but i'm not sure. in terms of getting counts occurrence: vocabulary = ['hi', 'bye', 'run away!'] corpus = ['run away!'] cv = countvectorizer(vocabulary=vocabulary) x = cv.fit_transform(corpus) print x.toarray() gives: [[0 0 0 0]] what i'm realizing countvectorizer break corpus believe unigrams: vocabulary = ['hi', 'bye', 'run'] corpus = ['run away!'] cv = countvectorizer(vocabulary=vocabulary) x = cv.fit_transform(corpus) print x.toarray() which gives: [[0 0 1]] is there way tell countvectorizer how you'd vectorize corpus? ideally outcome along lines of first example. in honestly, however, i'm wondering if @ possible outcome along these lines: vocabulary = ['hi', 'bye', 'run away!'] corpus = ['i want run away!'] cv = countvectorizer(vocabulary=vocab

unit testing - Python Mock not correctly setting return value -

i attempting build unit tests , have been using mock, upon using 2 patch statements, not able set proper return values. @patch('pulleffect.lib.google.gcal_helper.validate_and_refresh_creds') @patch('pulleffect.lib.google.gcal_helper.get_google_creds') def test_get_calendar_list_for_gcalhelper_without_credentials(self, mock_get_google_creds, mock_validate_and_refresh_creds): mock_validate_and_refresh_creds = "redirect" mock_get_google_creds = "credentials" credentials = pulleffect.lib.google.gcal_helper.get_calendar_list("name","widget") assert b'redirect' in credentials however assert fails , instead of expected string redirect instead <magicmock name = "validate_and_refresh_creds() id = 14054613955344> i wondering necessary have redirect returned instead. ha

java - Order Objects Compare -

this object: public class trackuserchanges{ private long id; private long previous; } i have arraylist. want sort objects this: - if getprevious() 1 object equal getid object, put first object 1 value on getid(). i have compareto method in class , don't want break that. created method : public int comparetrack(trackuserchanges o){ if(this.getprevious().equals((o.getid()))){ return -1; } ??return this.getprevious().compareto(o.getid()); } it's not good. ideas? example: id,previous trackuserchanges t = new trackuserchanges ( 2,1) trackuserchanges t1 = new trackuserchanges ( 3,1) trackuserchanges t2 = new trackuserchanges ( 1,1) in case t.getprevious() = t2.getid() want order : t2,t,t1 what going not idea. please read contract compareto() : the implementor must ensure sgn(compare(x, y)) == -sgn(compare(y, x)) x , y. (this implies compare(x, y) must throw exception if , if compare(y, x) throws exception.) t

You do not have sufficient permissions to access this page in Wordpress -

i want add new site in wordpress when log in http://localhost/wordpress/wp-admin/network/index.php showed me error. you not have sufficient permissions access page. i'm new in wordpress plz guide me how add new site ? it may due wp config files. trw chmod 777 /wp-admin/*.php, make sure file's owner. check out more infos : http://wordpress.org/support/topic/you-dont-have-permission-to-access-blogwp-adminoptionsphp

sockets - Can I receive an acknowledgement when a packet that I send leaves my NIC? -

my goal send same message continuously (if possible retransmit after previous transmission completed) using udp protocol until receive acknowledgement receiver stop transmitting same message. however, before retransmitting know if previous message has left nic succesfully (i not need know if has arrived succesfully receiver) sure not retransmit while previous message waiting @ nic buffer. there way receive type of acknowledegement nic when packet leaves nic?

openscenegraph - How to use ReaderWriterOBJ in OpenSeneGraph -

can explain me how use readerwriterobj in openscenegraph? want load obj file along mtl file. have built solution readerwriterobj code , created dll file. the readerwriter's file loaders. have use them in context of application, osgviewer, 1 of examples included in osg. if you've gone through process of building osg, might have built osgviewer, use appropriate dll's load files. eg osgviewer file.obj will open file.obj, associated material file[s].

asp.net mvc - Model Validation On Nested View -

i have view , data listing in view . when user select row , form posting ajax action , action returns row details partial view. user doing arrangements row details , submit form action.model validating @ action , must return model errors validatesummary. but not becouse if add model error , return partial view, main view of course not showing , shows partial view. i want add model error partial view inside view. how fix ? replace data list (or grid) ourside <form></form> or @html.beginform(){} . problem solved

java - Intent onPostExecute() AsyncTask -

im running asynctask in inner class , once complete within onpostexecute() want use intent pass values activity have 2 errors im not sure how fix. the errors occur on setresult() line @ result_ok , finish() line explaining these 2 actions cannot occur outside of activity. how use intent in onpostexecute of 'asynctask'? code: protected void onpostexecute(void result) { // todo auto-generated method stub super.onpostexecute(result); intent intent = new intent(); intent.putextra("jobs", jobstatus); intent.putextra("requestssent", requests); setresult(result_ok, intent); finish(); } you need use context of activity class following finish method: youractivity.this.finish() and result_ok exists on activity class, need: activity.result_ok so code must following: intent intent = new intent(); intent.putextra("jobs", jobstatus); intent.putextra("requestssent", requests); setresult( act