Posts

Showing posts from July, 2011

c++ - Populating a vector with random numbers -

i'll dive right in: given piece of code professor that's supposed generate random numbers , compiler (g++) keeps throwing these errors: "warning: pointer function used in arithmetic [-wpointer-arith] rand[i]=((double) rand() / (static_cast(rand_max) + 1.0))* (high - low) + low;" "error: invalid cast type 'std::vector' type 'double' rand[i]=((double) rand() / (static_cast(rand_max) + 1.0))* (high - low) + low;" both point function generates random numbers. trouble i've used exact same function before , worked fine. have no idea wrong. appreciated. note still new c++. i've included: cstdlib, stdio.h, cstdio, time.h, vector, iomanip, fstream, iostream, cmath. code have now: int main() { int n=20000; std::srand((unsigned)time(0)); for(int = 0; i<(n+1); ++i) { double high = 1.0, low = 0.0; rand[i]=((double) rand()/(static_cast<double>(rand_max) + 1.0))*(high - low) + low; } return 0; } you using nam

javascript - Color overlay on hover: jquery mosaic plugin -

how apply cover overlay on hover mosaic elements here: http://tympanus.net/development/gridloadingeffects/index.html the effect trying achieve can seen here: http://ultravisualtheme.tumblr.com/ i copy second link, can't make sense of code. reason ask doing first link because can understand whats going on there, , code site in similar manner. basically, have create overlay on top of div contains image. make children of div , use css: #image:hover > .overlay { width:100%; height:100%; position:absolute; background-color:#000; opacity:0.5; border-radius:30px; } you not need jquery here. fiddle: http://jsfiddle.net/6bjtq/ but if want use jquery anyway, use: $("#image").hover(function() { $(".overlay").css({//here goes same css definition}); }, function() { $(".overlay").css({//reset css default values after hover out}); });

php - PhPmyadmin SQL Query to insert meta_key & value IF another value exist -

ok looking sql query insert meta_key & value in specific table if value exist. using wordpress database. i want query search " wp_postmeta " table " qty (meta_key) " " 0 (meta_value) " , insert posts new meta_key " _wplp_post_front " meta_value " 1 " i new phpmyadmin , need help. _ __ _ __ _ __ _ __ _ __ _ __ _ _____update!!! ok once again have found solution third party website: insert wp_postmeta (meta_key, meta_value, post_id) select "_wplp_post_front", 1, post_id wp_postmeta outside_table meta_key = 'qty' , meta_value = '0' , not exists (select * wp_postmeta post_id = outside_table.post_id , meta_key = "_wplp_post_front" , meta_value = 1 ) ok once again have found solution third party website: insert wp_postmeta (meta_key, meta_value, post_id) select "_wplp_post_front", 1, post_id wp_postmeta outside_table meta_key = 'qty' , meta_value = '0

azure - How to handle long running jobs that are posted to a service bus with only 5min peek lock -

what people tend when have design put jobs on service queue or topic takes longer 5min max of peeklock? i have been using onmessage(...) async messagepump of service bus , wondering if thats not such idea after since if start moving jobs table while processing them, messagepump empty queue , have problem elsewhere of making sure jobs scheduled between servers. if have long running message processing workflow can check lockeduntilutc property of message , call renewlock @ appropriate time. http://msdn.microsoft.com/en-us/library/windowsazure/microsoft.servicebus.messaging.brokeredmessage.renewlock.aspx in next release of sdk onmessage processing loop automatically convenience api idea use.

php - Export wordpress from OpenShift account -

i have blog hosted @ openshift move it, have wordpress installed using 1 small gear (not scalable). i've tried plugins wp clone wp academy , move wordpress server times out before backup/clone/zip file created. i able login openshift account using sftp manually copy wordpress installation new server structure different i'm used. i prefer use plugin wp clone wp academy, how can work? if not, wordpress files on openshift can copy them new host? thanks. we sorry see go, please email openshift@redhat.com if can stay! if have go, understand though, here breakdown of file locations (assuming used our quickstart): ~/app-root/data/uploads (files uploaded through wordpress ~/app-root/data/themes (themes uploaded through wordpress) ~/app-root/data/plugins (plugins uploaded through wordpress) ~/app-root/data/blogs.dir (uploads , assets wordpress multi-site installation) ~/app-root/repo/php (all other wordpress core files) you can use mysqldump command line wor

ios - Connect two labels to one outlet -

now understand question has been asked before, answers unsatisfactory. issue have view controller view , stuff in including label. added bunch of code , i'm expanding on it. have issue i've decided add uiview interface , has label , label going function label have in first uiview. problem don't want have go in view controller method , add line of code each time manipulate first label. there anyway can link label initial iboutlet have set first label? or have go in code , add line of code everytime manipulate first label? basically simple answer no. whether use outlets or outlet collection or tags or whatever, have one reference in code one label in interface, , another reference in code another reference in interface. can compress mode of expression cycle readily through references (as suggested in different answer), basic fact inescapable that, ultimately, way "talk to" label through 1 reference points that label , label alone. the way of get

caching - How to disable the Last Level Cache only of Intel Ivybridge CPU? -

i know how disable of 3 levels of cache on intel ivybridge cpu. need set cd bit of cr0 register 1 of cpus. however, want disable last level of cache (l3 cache) on intel ivybridget or sandybridge cpu , keep using l1 , l2 on chip cache. the reason why want experiment because want test performance of l3 cache , want see effect of not using l3 cache. could 1 give me pointer or insight on how achieve that?

oop - How to declare a dictionary compatible with any type in C# -

i have created abstract base class parent of other classes. have class database connection m fetching records , wanted records converted objects of class pass function. have written function .. enter code here //class appconnection.cs public static dictionary<int, baseclass> fetchobjects( string sqlquery, baseclass obj ) { datatable dt = myconnection.fetchrecords( sqlquery ); dictionary<int,baseclass> objdict = new dictionary<int, baseclass>(); for(int i=0; < dt.rows.count; i++ ) { obj.mapobjectbydatarow(dt.rows[i]); //abstract function in baseclass objdict.add(obj.id, obj); } return objdict; } i calling in child classes this, enter code here class customer:baseclass { public static dictionary<int, customer> fetchcustomers() { string sql = "select * customers"; dictionary<int, customer> dict = appconnection.fetchobjects(sql, new customer() ); return dict;

Mule - Which code snippet would you recommend for FunctionalTestCase, and what are their differences? -

i come across 2 seemingly similar yet different variations of codes functional testing. recommended 1 , differences? === snippet 1 === @override protected string getconfigresources() { return "src\\main\\app\\simplejunittest.xml"; } @test public void testhelloworldflow2returns2() throws exception { runflowwithpayloadandexpect("simplejunittestflow1", "sometextxxxx", "pass"); } ///////////////////////////// helpers //////////////////////////////////////// /** * run flow specified name using specified payload , assert * equality on expected output * * @param flowname name of flow run * @param expect expected output * @param payload payload of input event */ protected <u, t> void runflowwithpayloadandexpect(string flowname, u payload, t expect) throws exception { flow flow = lookupflowconstruct(flowname); muleevent event = functionalte

Union of set of ranges in Scheme -

i need write scheme function (union s1 s2) when given 2 sets, let's s1 = ((1 3) (5 13) (25 100)) s2 = ((2 4) (17 26) (97 100)) will give (union s1 s2) ----> ((1 4) (5 13) (17 100)) also if s1 = ((1 3) (5 13) (25 110) (199 300)) s2 = ((2 4) (17 26) (97 100) (110 200) (288 500)) then (union s1 s2) ----> ((1 4) (5 13) (17 500)) can suggest me how this? have no idea how start. instead of working 2 sets, suggest merging 2 sets 1 combined list (ordered on car ) making second pass merge elements, maintaining accumulator list (result, in reversed order). that way, compare first , second element of input (merged) list, , know ordered, simplifies code: empty merged list => return result one element left => push element onto result, , return result, reversed back at least 2 elements in list if 2 elements don't overlap, push first element onto result, , loop on rest of merged list, otherwise replace 2 elements merged element, loop

php - How save data to database using recursion -

my mysql table looks this: page_id parnt_id page_name ------------------------------------ 1 0 aboutus 2 1 contact_us 3 2 home 4 2 currear and have array looks this: array ( [0] => array ( [id] => 1 [children] => array ( [0] => array ( [id] => 2 [children] => array ( [0] => array ( [id] => 3 ) ) ) ) ) ) how can add above array database using recursion? $all_pages = $given_array; function save_page($page, $parent_id = 0) { $page_id = $p

SVN Blame for Vim -

is there pluggin vim can show 'svn blame' output in vertical split showing line line author , revision number ( 'gblame' in vim-fugitive git). the vcscommand.vim - cvs/svn/svk/git/hg/bzr integration plugin has :vcsannotate command shows annotations either prepended copy of current buffer, or (with ! ) in vertical split moves original buffer.

vba - How to check if a particular object is a collection or a string? -

specifically, i'm working itemproperties in context of outlook 2010. want info out of info stored in itemproperties of mailitem. this: dim folderitems object set folderitems = folder.items set thisitem = folderitems(index).itemproperties p = 1 thisitem.count debug.print thisitem.item(p).name & " = " & thisitem.item(p).value '= stuff involving thisitem.item(p) etc next the problem works fine long value straightforward string, gives error when comes things "actions", value collection/array in (have .count property), or not straightup string value. i'm trying think of way catch kinds of value, handle them differently in code, i'm not able find one. any help? use typeof() -method example: if typeof(thisitem.item(p)) string msgbox "string" end if to check wheter object supports property: if iserror(thisitem.item(p).value msgbox "item doesn't support value property" else msgbox

How to check if file already has data (in C)? -

i trying write simulation program in c appending file opening in append mode. file csv (comma separated values). i write headings of simulation information before write actual values don't seem unrelated. there easy way this? for example: central node, system delay, bandwidth requirement 14,240,11 4,285,23 13,300,9 my code looks this: void data_output(file *fp){ struct stat buf; file fd = *fp; fstat(fd, &buf); fprintf(stderr,"debug------%d\n",buf.st_size); } the output error is: ff.c: in function ‘data_output’: ff.c:296:2: error: incompatible type argument 1 of ‘fstat’ fstat(fd, &buf); ^ in file included /usr/include/stdio.h:29:0, ff.c:1: /usr/include/sys/stat.h:148:5: note: expected ‘int’ argument of type ‘file’ int _exfun(fstat,( int __fd, struct stat *__sbuf )); ^ makefile:7: recipe target 'ff.o' failed make: *** [ff.o] error 1 what doing wrong? should typecasting in order make work? you can check size of f

c - Concatenation of two definition -

#define id proj1 #define proj id##_data.h as per requirements definition of proj should have proj1_data.h when print proj should give proj1_data.h , please me desired result. in advance ! you can print string. print proj , need turn string. #define stringize(x) #x #define stringize2(x) stringize(x) stringize applies stringizing operator on argument. turns argument string, surrounding quotation marks, , escaping contents necessary create valid string. stringize2 used allow argument expanded preprocessor before turned string. useful when want stringize expansion of macro instead of macro itself. example stringize2(__line__) result in string represents current line in file, e.g. "1723" . however, stringize(__line__) results in string "__line__" . your definition of proj faces similar issue. results in token id_data..h rather proj1_data.h . need level of expansion indirection allow id expand before concatenate. #define paste(x, y) x #

javascript - How to divide or display the 'div' data as mulitple columns in html? -

in page large data there, around 200 items. need display 1 one means new row that. it's occupying space need scroll see data. decided display 200 items 4 or 5 columns. please tell me how that? please suggest me idea display 200 (large data) in page. samples let me know? how dynamically populate multiple coulmns in html ? if suppose 200 items there divide 4 columns first column 50,2nd column 50 , 3rd , 4th 50.if 201 item added should dynamically need add in first coulmn .how acheive using html? thanks displaying 200 @ time not big task depend on data first analyze data check images size if exists , decide how data display there many links available in jquery check lazy loading of jquery http://www.appelsiini.net/projects/lazyload https://plugins.jquery.com/lazy/

How to represent a new part of class in python? -

for example had class this: class planet(object): def _init_(self, id = 0, name="", mass = 0) self.id = id self.name = name self.mass = mass can write planet earth - import(whatever) name=earth id=1 mass = 5.97219 × 1024 kg or must planet earth written in same way class (sorry bad formatting, code each combined 1 block not separate ones)? you need create instance of planet , initialize it: earth = planet() earth.name = "earth" earth.id = id earth.mass = 5.97219 × 1024 kg

python - Plotting a decision boundary separating 2 classes using Matplotlib's pyplot -

Image
i use tip me plotting decision boundary separate classes of data. created sample data (from gaussian distribution) via python numpy. in case, every data point 2d coordinate, i.e., 1 column vector consisting of 2 rows. e.g., [ 1 2 ] let's assume have 2 classes, class1 , class2, , created 100 data points class1 , 100 data points class2 via code below (assigned variables x1_samples , x2_samples). mu_vec1 = np.array([0,0]) cov_mat1 = np.array([[2,0],[0,2]]) x1_samples = np.random.multivariate_normal(mu_vec1, cov_mat1, 100) mu_vec1 = mu_vec1.reshape(1,2).t # 1-col vector mu_vec2 = np.array([1,2]) cov_mat2 = np.array([[1,0],[0,1]]) x2_samples = np.random.multivariate_normal(mu_vec2, cov_mat2, 100) mu_vec2 = mu_vec2.reshape(1,2).t when plot data points each class, this: now, came equation decision boundary separate both classes , add plot. however, not sure how can plot function: def decision_boundary(x_vec, mu_vec1, mu_vec2): g1 = (x_vec-mu_vec1).t.dot((x_vec-mu_

rewrite - nginx proxy_pass not work with subdirectory -

i want rewrite , proxy every url configure, url not proxy: http://example.com/qwe/ewq , proxy work when use this: http://example.com . think 1 solution remove else url. 1 rewrite , not redirect. ... nginx.conf: server { listen 10.10.10.10:9999; server_name _; # set $test_uri http://example.com ; # set $test_uri $scheme://$host$request_uri; # if ($test_uri != $scheme://$host$uri) { # rewrite ^ $scheme://$host$uri permanent; # } # if (-e $args) { # set $args /; # } # if ($request_uri != $test_uri) { # rewrite ^ http://example.com; # } # location /(.*) { # rewrite ^ http://example.com ; # } # rewrite ^http://(.*)/(.*)$ http://$1/ last; # rewrite ^(.*)/(.*) $scheme://$1/ permanent; location / { #rewrite ^(.*)$ / permanent ; proxy_pass http://192.168.1.10:8080/;

sql - Unable to add xml node using .modify if Target xml contains default namespace -

here need insert source xml node target xml using .modify function in sql server. goes fine extent when have named namespaces. moment change 1 of namespace default stops inserting node. following code problem declare @sourcexml xml declare @targetxml xml declare @tempxml xml set @targetxml = '<?xml version="1.0"?> <message> <mainbody> </mainbody> <part> <innerbody xmlns:ac="http://www.example.org/standards/1" xmlns:rlc="http://www.example.org/standards/standard" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> </innerbody> </part> </message>'; set @sourcexml = '<rlc:movement xmlns:rlc="http://www.example.org/standards/standard" type="outstanding"> <rlc:amt ccy="gbp" >500000.00</rlc:amt> </rlc:movement> <rlc:movement xmlns:rlc="http://www.example.org/standards/standard" type="previous">

math - Finding capable function in an equation with Mathematica or Matlab -

i want find function f(xi) suffices following equation: (vi-xi)f(xi)'=f(xi) when xi = k*vi, vi constant , xi variable. anyone know howto describe problem in mathematica or matlab? great thanks! mathematica eq = (vi - xi) d[f[xi], xi] == f[xi]; dsolve[eq, f[xi], xi] (* {{f[xi] -> c[1]/(vi - xi)}} *) matlab syms vi xi f(xi) dsolve( (vi -xi)*diff(f)==f) ans = c2/(vi - xi) maple restart; dsolve((vi - xi)*diff(f(xi),xi)=f(xi),f(xi)); (* f(xi) = _c1/(vi-xi) *)

ruby on rails - How to create an action where would be a form for sign in/up with Devise? -

i building mobile version of our website , need create different views sign up/in mobile users. these 2 actions should in different controller. my problem don't know how prepare instances sign up/in devise in different controller(s)... how make that? thanks you mean want implement sign up/in in own controller? if so, can modify routes.rb first devise_for :users, :controllers => { :sessions => "controllername" } and modify controllername_controller.rb class controllernamecontroller < devise::sessionscontroller def create # implementation end def destroy # implementation end end

Performance issue of dynamically adding point to a C# chart -

i have big chart has more 16000+ points. while dynamically adding point end of chart, chart facing heavy redraw job. when data frequency rather high, chart dead , cpu on full load. do have idea optimize performance? is there possibility have chart redraw new part not whole chart? use addxy add new point set. can see long add dynamic code program stucked. fullchart.series["lastpriceseries"].points.addxy(time, mktdata.lastprice); fullchart.series["highseries"].points.addxy(time, mktdata.askprice1); fullchart.series["lowseries"].points.addxy(time, mktdata.bidprice1); fullchart.series["volumeseries"].points.addxy(time, volume); thanks in advance. there several tips optimize mscharts. please try enclose portion of code add point by myserie.points.suspendupdates(); ... myserie.points.resumeupdates(); 16000 points lot. optimization technique consists in using decimation algorithm limits amount of displayed points actual width

c++ - Template: get proper variable name from type name -

let's say, have 4 arrays of 4 different pointer types. , want template function, stores it's argument in proper array. this int* arr_int[10]; double* arr_double[10]; uint64_t* arr_uint64_t[10]; template <typename t> void add_value (int pos, t value) { //i want store value in array of it's type arr_##(*t)[pos]=value; //of course, not work :) } int main(int argc, char *argv[]) { int = 2; double b = 4.2; uint64_t c = 123456; add_value(0,&a); add_value(0,&b); add_value(0,&c); //add more values //do arrays .... return 0; } is possible? no, name generation not possible via templates in way mean it. can nick said - create overloaded functions, or create template class static array of specified type: template <typename t> struct array_holder { static t * arr[10]; }; template <typename t>

Matlab: Concatenating single-channel models to a multi channel model with System Identification Toolbox -

i have following problem: have simo system , want apply subspace identification algorithm (moesp in specific case) using matlab function n4sid (which performs subspace identification of state space models) of system identification toolbox. due large amount of data , outputs not possible feed algorithm data @ once more gradually more suitable. consider have 2 outputs 1 single input: perform subspace identification of 2 siso systems independently , concatenate them obtain final , complete model having same order of previous models: possible default system identification toolbox of matlab? have reference? have asked on matlab forums no answer plus read user's guide of system identification toolbox. // example: in = excitation signal. out1, out2 = output signals // ts = sampling interval signals 0 mean // putting data iddata format dat1 = iddata(out1,in,ts); dat2 = iddata(out2,in,ts); //considering model order of 10 m1 = n4sid(dat1,10); // m1 = siso model output out1 , input

sql - Where can I download Musical DataBase -

hi ! first, please forgive me language, i'm french. i'm creating website music, (no need more information). need (complete) music sql database, album/artist/music/... , google didn't give me awnser. so if here know or how can find start website database, ! quentin with quick research on google found musicbrainz link site link database download

Convert my blocked blog into an unblocked website -

i writing blog last 4-5 years, how google has blocked adsense in blog. have filled appeal form rejected. if convert blog website through "setting" options in blog setting adsense unblocked or blocked after converting website ? you should ask question official adsense support. here: https://productforums.google.com/forum/#!forum/adsense

php - Magento - Categories do not show properly in catalog -

Image
i'm using magento 1.81 codewix category accordion menu extension. the code: class codewix_leftmenu_block_navigation extends mage_catalog_block_navigation { protected $_leftcategories; /** * top level parent category current category * * @var int */ protected $_parent; protected function _construct() { $path = $this->getcurrentcategorypath(); $parent = $path[count($path)-1]; if (!$parent) { $parent = mage::app()->getstore()->getrootcategoryid(); } $this->_parent = $parent; } public function getblocktitle() { } public $curr_class ="main-categ"; public function get_categories($categories) { $i=0; $helper = mage::helper('catalog/category'); if($i==0) { $ul_id="outer_ul"; } else { $ul_id="inner_ul"; } $array= '<ul id="'.$ul_id.'" class="'.$this->curr_class.'">';

java - convert certificate from pem into jks -

i have convert certificate in pem format java key store. to use 1 tomcat @ windows server i've got files: cert_request.csr -----begin certificate request----- ... -----end certificate request----- cert_public_key.pem -----begin certificate----- ... -----end certificate----- cert_private_key.pem -----begin encrypted private key----- ... -----end encrypted private key----- cert.txt contains 16 digit key i tryed combine pem files (by combining 2 files chain together) , converted openssl .der file , import keytool new keystore same .p12 directly imported keystore i tryed change -----begin encrypted private key----- ... -----end encrypted private key----- into -----begin rsa private key----- ... -----end rsa private key----- and tryed 3 ways above what have working certificate? edit: i combinied cert_public_key.pem , cert_private_key.pem cert_comb.pem -----begin certificate----- ... -----end certificate

android - YouTube api: Not connected. Call connect() and wait for onConnected() to be called -

i using youtubefragment in android app , getting following crash on android 4+ devices. java.lang.illegalstateexception: not connected. call connect() , wait onconnected() called. @ com.google.android.youtube.player.a.at.i(unknown source) @ com.google.android.youtube.player.a.an.k(unknown source) @ com.google.android.youtube.player.a.an.a(unknown source) @ com.google.android.youtube.player.a.ao.<init>(unknown source) @ com.google.android.youtube.player.a.f.a(unknown source) @ com.google.android.youtube.player.q.a(unknown source) @ com.google.android.youtube.player.a.at.g(unknown source) @ com.google.android.youtube.player.a.ax.a(unknown source) @ com.google.android.youtube.player.a.aw.a(unknown source) @ com.google.android.youtube.player.a.av.handlemessage(unknown source) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:5450) @ java.lang.reflect.method.invokenative(native me

html - Django Form POST with Back button. -

i submitting form using django . things went until hit button. time ie displays " the wab page has expired. " i have searched lot, can not find exact concept right. open page request . /user/search/ post request form data on same page /user/search/ [optional] either change params , post hit button. in both cases webpage expired. please guide me how make work & avoid error message? you shouldn't using post search forms. post actions change data on server. use , won't have problem.

Getting fields information using java reflection -

i working on program print information related object, information includes: for each slice (class in object hierarchy) in x: print class name of slice. for each non-static field in slice: print field modifiers followed field name. print value of field follows: if field null print null. if field primitive type print value if field string print value if field array: loop on elements in array print index recursively print details of array item otherwise, recursively print details of field i have pretty printed information using code below: public void print(object obj) { class cl = obj.getclass(); while(cl != null) { system.out.println("class name: " + cl.getname()); field[] fields = cl.getfields(); system.out.println("fields: "); for(int i=0; i<fields.length; i++) { string modifier = modifier.tostring(fields[i].getmodifiers()); string name

Send and Receive IQ ASMACK Android XMPP -

i new xmpp protocol, tried find examples of sending , receiving iq packets in xmpp android, failed, tried using following chunk of code did not help. code: final iq iq = new iq() { public string getchildelementxml() { return "<iq type='get' from='9f30dacb@web.vlivetech.com/9f30dacb' id='1'> <query xmlns='http://jabber.org/protocol/disco#info'/></iq>"; // here query //"<iq type='get' from='9f30dacb@web.vlivetech.com/9f30dacb' id='1'> <query xmlns='http://jabber.org/protocol/disco#info'/></iq>"; }}; // set type iq.settype(iq.type.get); // send request connection.sendpacket(iq); i tried using code, did not send message server. can me right piece of code? can send iq's server , receive response haven't tested yet, try iq iq = new iq(); iq.setto("destination@server"); iq.setfrom("9f30dacb@web.vli

ios - Resize webview iphone 5 -

Image
i'm seeking method resize webview according current iphone. i tried change frame of webview, check autolayout etc. it's not running, tried other solutions, , didn't succeed resize webview. i tried example nothing change : _contenunews.frame = self.view.frame; i don't want use scale page fit. i want webview take screen. someone me ? thx if webview added via ib , if using autolayout can not resize frame. need uncheck autolayout option ib. after try resize frame of webview. though didn't want use scale fit use scale fit. may other adding answer: self.webview.scalespagetofit =yes; the above code make sure content of uiwebview loaded inside view frame. hope helps.. :)

version control - How to use Git to tag a commit rather than a hash -

i have large series of commits, various version tags, i.e.: root->x->x->1->x->x->x->2->x->x->3->x->4->x->x->x->5->master i want insert new commit near start of this. problem is, need go through , re-tag everything, because tree ends looking this: root->x->x->y->x->x->x->x->x->x->x->x->x->x->x->x->x->x->master \->1->x->x->x->2->x->x->3->x->4->x->x->x->5 is there way can tag specific commit, rather specific hash? when rebase, tags apply same specific commits, in new tree, rather original commits? note: not interested in moralizing - please don't post answers saying things "you're doing wrong" or "that's not how versioning supposed work" unless can provide constructive alternative. need way mark commits persist after rebase, if possible solution "git doesn't that, use x instead&quo

Wrapping an opengl object into a c++ class with copying -

how done? for example might have texture class. of course hold gluint id, , maybe other fields such width , height. when object needs copied whatever reason, user-defined copy constructor needed. now, in case of opengl texture, possible copy texture object. shader programs, or fbos? these can't copied easily. how people go doing this? should reference counted? should copying disabled on objects? should copying disabled on objects can't copied? what best way go this? in advance answers. for texture there may point copying it, shader object less (in experience). objects copying makes sense, don't want want make explicit. either use wrapper class by-value (so handle opengl entity) , uses reference counting internally, or consider wrapper class instance own opengl entity , use reference counting on wrapper class (using std::shared_ptr example). in latter case implement copy-constructor on entities makes sense. however, in order avoid unintentional use res

javascript - Not getting response in ajax success function -

javascript code: window.gettablecontent = function() { $.ajax({ url: "/oeb_infos/" + $("#oeb_info_id").val() + "/show_toc.js", type: "get", async: false, success: function(data) { alert(typeof data); if (data) { data = $.parsejson(data); $("#toc.toc").html("<ul>"); $.each(data, function(header) { var value; value = ''; $.each(header.list, function(j) { return value = value + "<ul>"; }); value = value + ("<li><a href='#" + toc_part['id'] + "'>" + toc_part['value'] + "</a></li>"); $.each(header['list'], function(j) { return value = value + "</ul>"; }); $("#toc.toc").append(value); }); $("#toc.toc").appe

javascript - Rhinoslider not working "Effect for explode not found" -

im trying use awesome jquery rhinoslider plugin , not work 1 bit. not demo downloaded works, throws effect explode not found , "preparations explode not found" in console. choose effect explode happens every effect, if choose none effect. documentation pretty poor regarding kind of questions , dont find lot of answers on internet plugin.. know logs mean? included every other scripts (easing, mousewheel) , said, not demo downloaded working. much! you need explode effect jqueryui download page

node.js - NodeJS : Differences between http.createServer and express.createServer? -

1/ .createserver module "http" 2/ .createserver expressjs --> better ? thanks in advance. expressjs builds on top of http.createserver. recommend using expressjs it's far easier.

android - How to populate listview with some specific data from SQLite ?? not whole -

in sms app android, don't want show these sms in native inbox , sent items. have created sqlite database storing sent , received sms private app. sqlite database code : protected static final string table1=("create table " +table_sms+" (" + key_messageid+ " integer primary key autoincrement, " +sms_time+ " text, " +phone_number+ " text, " +message_body+ " text, " +flag+" text);"); public void insert_sms_data(string formatedtime, string number, string body,string flag){ try{ sqlitedatabase db = this.getwritabledatabase(); contentvalues cv = new contentvalues(); cv.put(sms_time, formatedtime); cv.put(phone_number, number); cv.put(message_body, body); cv.put(flag, flag); db.insert(table_sms, null, cv); db.close(); } catch(exception ex) { log.e("error in insertion&

sql server - SQL mobile number validation -

i have sql database filter out valid mobile numbers. i use follows; where pn.phonenumber '+[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]' or pn.phonenumber '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]' or pn.phonenumber '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]' or pn.phonenumber '[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9]' however still receive numbers such 0000000 , 0 , 0000 etc. of numbers aren't irish mobiles either don't begin 08 . fix there if wanted beginning of number begin 087 input [0][8][7] instead of [0-9] ? try testing ! this'll give numbers starting 087 , mobile(length)=10 select * table mobile_number '087%' , len(mobile_number)=10 demo

java - Storing Class in Array -

i have n class (class1, class2, .., classn), each have static main methods. i wish store class in array, , call main method once each class. type have declare array? this have done according reply t.j. crowder arraylist<class> meoa = new arraylist( arrays.aslist(class.forname("mypackage.class1"), class.forname("mypackage.class2"), class.forname("mypackage.class3"), class.forname("mypackage.class4"), class.forname("mypackage.class5"))); for(class cls:meoa) { system.out.println("invoking:"+cls.getname()); method m = cls.getdeclaredmethod("main", string[].class); object[] arg = new object[1]; arg[0] = new string[] {}; m.invoke(null, arg); } the type clas

Need help to integrate Visual SVN Server [Enterprise] with Bugzilla -

i running windows 7 32 bit. my requirement to, integrate visual svn server [enterprise] edition bugzilla. have bugzilla , running, when dev team commits code change, logs/events/tags provided them should reflected against bug id against patch deployed. please let me know if there plug-ins/add-ons/hook scripts available integrate these 2 tools. regards, anand

php - Foreach loop full execution and stop the rest of the script -

i have product table checking quantity respective product id(s) valid or not.. this code snippet : $pids = explode(',',$pid); /*in form of 2,3,4.....*/ /*$pid->product_id*/ $q = explode(',',$q_total); /*in form of 2,3,4.....*/ /*$q->quantity*/ /*checking start*/ foreach($pids $index => $ps){ $quants = $q[$index]; $sql = $stsp->query("select quantity product id='$ps'"); $row = $sql->fetch(pdo::fetch_assoc); $quantity_rem = $row['quantity']; if($quants > $quantity_rem){ $array = array(); $array['errquant'] = 'wrong_quant'; $array['error_pr'] = $ps; echo json_encode($array); exit; /*stop rest of code executing*/ } } /*rest of code outside loop*/ so here happening checks quantity ( $quantity_rem ) table of product id , if quantity less quantity given ( $q ), script stops , echo product id.. but have more 1 product .. it's not checking rest since whe

How do I add Camel Support to an existing application -

i want "open" application based product enterprise integration camel. is, want customers buy app able provide information app via camel, without having create full public api on app. i've read lot of camel documentation, examples, book, i'm still having trouble getting started conceptually. first, can camel running: app has spring support, don't know how "deploy" it. let me set huge oversimplification of use case: let's want app pop dialog message in it. web app controls when dialog pops up. i want message come other software system customer owns - , want via camel. (could activemq, email, file deposited somewhere, stuff camel supports) the customer has configured message in app @ earlier point, key message get. it's inout exchange (in camel terms). in other words: at configuration time, customer says: "i have 'foo' messages need shown when dialog pops". at runtime app says: "hey camel, i'm show dialo

html - href links are not clickable -

i have been working on small project (just fun , practice skills, no intent release). i have put on free hosting services others can see (the issue present on local copy). none of links in main content of page clickable, assume due bad html , css. please can suggest why this page you have this: #content:after { content: ''; display: block; position: absolute; left: 0; top: 0; width: 100%; height: 100%; background-image: url('images/bg2.png'); opacity: 0.5; display: inline-block; min-height: 1500px; } and on page. can't reach links

javascript - Morris Bar chart dynamic labels -

is possible setup label names hash sent morris? morris.bar({ element: 'mevsother', data: $('#mevother').data('result'), xkey: 'created_at', ykeys: ['me', 'rank'], labels: ['me', 'them'] }); hash exemple: `[{"created_at":"2014-02-24","name":"john","me":0,"rank":0}...` so want 1 of label take value of name how can this? instead of 'them' value of name: john . you can parse data variable , value it. according hash can be: var result = $('#mevother').data('result'); var labels = ['me', result[0].name]; morris.bar({ element: 'mevsother', data: result, xkey: 'created_at', ykeys: ['me', 'rank'], labels: labels });

multithreading - Current thread count while using Executors.newSingleThreadExecutor().execute -

i using executors.newsinglethreadexecutor().execute execute method, inside method copy files drive, after copying, rename file.in file name have name along current thread count i.e if 1st thread file name xxx_1, xxx_2 second , on.is possible implement it?(the naming of file inside calling method) if yes, can please suggest me solution. in advance. you can use static variable , increment in processing method (the method runs in separate thread)

android - Difficulty with Phonegap/Genymotion -

Image
i following tutorial build exercise tracker app one: http://code.tutsplus.com/tutorials/build-an-exercise-tracking-app-geolocation-tracking--mobile-11070 i have installed phonegap/cordova believe, , i´m using genymotion android emulator find faster. i believe have followed steps in tutorial properly, won´t display page right. seems there problems css-formatting. first of all, looks chaotic, if has crashed. change emulator "flip" phone , again, , looks normal. no style formatting. ideas? here photo of how looks in folder run from, , how looks in emulator. i sick of installments necessary , hoped got work haha. hope not more done. not sure if relevant, use mac , edit code in sublime text2. i think got problem linking script. got same problem , fixed replacing them. the code this: -script type="text/javascript" src="cordova-1.7.0.js" and realized entire path wasn't there change to: -script type="text/javascript"

python - cursor.fechtmany(size=cursor.arraysize) in Sqlite3 -

i want retrieve 100 first rows of sqlite3 database: connection = sqlite3.connect('aktua.db') cursor = connection.cursor() print('actual \tcliente \thistórica') cursor.execute("select * referencias r_aktua '%k'").fetchmany(size=100) row in cursor: print('%s \t%s \t%s' % row) cursor.close() connection.close() my code retrieves rows of database (+4000). i've read sqlite3.cursor.fetchmany docs , sqlite python tutorial . what's wrong? use limit sql selection: "select * referencias r_aktua '%k' limit 100" or changue code to: rows = cursor.execute("select * referencias r_aktua '%k'").fetchmany(size=100) row in rows: print('%s \t%s \t%s' % row)

c# - TimeSpan not working -

heres code have re arranged, still have same problem, not able find start , end times on last page? how do this? public void start() { datetime starttime = datetime.now; } protected void btnstart_click(object sender, eventargs e) { start(); response.redirect("~/end.aspx"); } public void end() { datetime endtime = datetime.now; } protected void btnend_click(object sender, eventargs e) { end(); response.redirect("~/display.aspx"); } public partial class display : system.web.ui.page { protected void page_load(object sender, eventargs e) { timespan timespent = endtime - starttime; lbldisplay.text = string.format("time: {0}", timespent); } } now can me on this? you not need convert string. datetime start = datetime.now; datetime end = datetime.now; (note: 2 times above identical) once have done that, can use 1 of

oracle - do you need COMMIT; after INSERT /*+ append */ -

i have commit after every insert statement. i wondering if need commit; after insert /*+ append */ ... a commit not required directly after insert /*+ append */ ... . common convention because of issues caused direct-path writes. direct-path inserts write directly data files. locks segment other dml , prevents same session querying table or generate ora-12838: cannot read/modify object after modifying in parallel . other restrictions, when commit depends largely on application's concept of transaction, brian driscoll pointed out.

java - Run a function synchronously in another thread -

how can run function synchronously in thread, meaning main ui thread has function calls function work on thread, waits new thread finish , returns value: int mainfunction() //this function on main ui thread { return doworkonnewthread(); } int doworkonnewthread() { //do work on new thread } you can use async task this, though it's asynchronous. can use callbacks onpostexecute , onprogressupdate update values needed. should note don't want synchronized block ui thread cause application not responding alert depending on how long calculation takes.

oracle sql concat query title -

for course of databases got home sql excercises. 1 of them result this: who earns _____________________ mr martin earns 1250 month now got way select right data in: select 'mr ' || ename || ' earns ' || sal || ' month ' emp ename = 'martin'; but can't find how put title on top of query? can me on that? as "who earns what" like this: select 'mr ' || ename || ' earns ' || sal || ' month ' "who earns what" emp ename = 'martin';