Posts

Showing posts from April, 2010

return result of recursively executed query using codeigniter -

i new codegniter. have used following code execute function recursively. in first call pass reply_id in function have used query select id having parent_id = reply_id in foreach same process selected ids. now want return combine array recursion.because each id query executed , new result each time. how can that?? $resultq3 = $this->showreply($reply_id); //first call function <?php public function showreply( $reply_id ) { $q1 =$this->db->select('*') ->from('forum_reply fr') ->where('fr.parent_id',$reply_id) ->order_by('fr.id ')->get();; foreach( $q1->result_array() $row4 ) { $id = $row4['id']; $parent_id = $row4['parent_id']; if( $parent_id !=0 ) { $this->showreply( $id ); } } return $result; //here want return result } ?> edited code: $result

linux - Prevent process from killing itself using pkill -

i'm writing stop routine start-up service script: do_stop() { rm -f $pidfile pkill -f $daemon || return 1 return 0 } the problem pkill (same killall) matches process representing script , terminates itself. how fix that? you can explicitly filter out current pid results: kill $(pgrep -f $daemon | grep -v ^$$\$) to correctly use -f flag, sure supply whole path daemon rather substring. prevent killing script (and eliminate need above grep ) , killing other system processes happen share daemon's name.

How to select the device to install app to with the default ant build.xml generated by "android create project"? -

i've run: android create project \ --target 1 \ --name myname \ --path . \ --activity myactivity \ --package com.cirosantilli.android_cheat which generated build.xml . if run: adb debug install with multiple devices available, fails with: [exec] error: more 1 device/emulator so how set correct device? i know adb need -s : adb devices -l adb -s emulator-5554 installd my.apk and know generated .apk located, cleaner if default build.xml , knows location of .apk . it possible pass arguments adb as: ant -dadb.device.arg='-s emulator-5554' installd

c - How can I associate a global register variable to %gs (or %fs)? -

on x86_64 i'm playing toy os won't support multithreading. i tried associate 2 global register variables %gs , %fs, way: register foo* foo asm("gs"); register bar* bar asm("fs"); but gcc complains "gs" , "fs" not valid register names. i tried other registers (eg r12 , r15) , compiled. tried %gs , %fs , compilation errors persists. is possible use these registers way? i've read issues these registers in amd64, i'm unable understand problem pointed there: gcc bug or problem use of register variables in amd64? an 80386 compatible cpu has 6 segment registers named cs, ds, ss, es, fs, , gs. these segment registers used feature called segmentation , act pointer segment descriptor table, pointees implicitly added in address computations. † these segment register cannot realistically used hold arbitrary data specific ways ( les , friends) load value them results in exception when load invalid value. used f

mongodb - Working example of celery with mongo DB -

i'm new celery, , working on running asynchronous tasks using celery. i want save results of tasks mongodb. i want use amqp broker. celery project examples didn't me much. can point me working examples? to use mongodb backend store have explicitly configure celery use mongodb backend. http://docs.celeryproject.org/en/latest/getting-started/brokers/mongodb.html#broker-mongodb as said documentation not show complete working example. started playing celery have been using mongodb. created short working tutorial using mongodb , celery http://skillachie.com/?p=953 however these snippets should contain need hello world going celery , mongodb celeryconfig.py celery.schedules import crontab celery_result_backend = "mongodb" celery_mongodb_backend_settings = { "host": "127.0.0.1", "port": 27017, "database": "jobs", "taskmeta_collection": "stock_taskmeta_collecti

amazon cloudfront - Time of logs of cloud front -

i try collect cloud-front-logs s3's bucket , put database. date time of logs in these files problem. logged in time of standard time? or time of x-edge-location? if want fix japan's standard time should calculate x-edge-location? i have 1 more question. logs delay when written on s3 bucket?? if observe s3bucket using "s3cmd ls s3://mys3bucket/". log's count changes within 2 hours. https://forums.aws.amazon.com/thread.jspa?threadid=30346 the date , hour specified according gmt time zone. found answer. http://docs.aws.amazon.com/amazoncloudfront/latest/developerguide/accesslogs.html cloudfront saves log files within 24 hours after receiving corresponding requests.

Best way to recreate snapshots in sql server 2008 -

i want update database snapshot every hour, keeping name unchanged. way found how - drop/create pattern. there 3 minutes downtime between drop , create events. there way update snapshot faster? my previous answer turned out junk because can't re-name database snapshots. can do, however, create shell database job contain synonyms objects in database snapshot. it'd work this: create new database snapshot create synonyms objects in new snapshot, dropping old synonyms necessary once synonyms have been repointed, drop old snapshot.

c - How to check first char of a char pointer variable wihtout making any changes to the variable itself -

for example, want check whether first character of char pointer variable a . dont want char pointer variable changed @ all, want check first character. the first character @ start of characters pointed pointer can checked against value. in fact, work if pointer points single character: int main() { char *a; = malloc(1); *a = 'a'; if('a' == *a) { printf("a first character\n"); return 0; } alternatively, accomplish same thing treating array: int main() { char a[]="a string of characters"; if('a' == a[0]) { printf("a first character\n"); return 0; }

java - JaxB to read class hierarchy -

just extending parsing class hierarchy using jaxb question. want read following xml file using jaxb <import> <table name="user"> <row> <user_id>1</user_id> <row_version>1</row_version> <user_name>navnath</user_name> <login>navnath</login> <login_password>navnath</login_password> </row> <row> <user_id>2</user_id> <row_version>1</row_version> <user_name>kumbhar</user_name> <login>kumbhar</login> <login_password>kumbhar</login_password> </row> </table> <table name="work"> <row> <work_id>1</work_id> <work_name>work1</work_name> <row_version type="n"&g

Jackson to include 'class' field when serializing object to json -

i need grails app communicate (json) client uses jackson. default grails include 'class' in generated json. on other hand, default jackson's objectmapper doesn't recognize 'class', throws error. i've found solution, adding @jsontypeinfo(use=jsontypeinfo.id.class, include=jsontypeinfo.as.property, property="class") on each pojo classes being used. but, don't prefer approach. because pojo have dependency jackson's jar. there easy alternative? i trying figure out objectmapper.getserializationconfig(). ... , still couldn't found alternative replace annotation. thanks are using type info polymorphic instantiation or ignoring information? use instead @jsonignoreproperties({"class"}) on classes. if don't want add annotation classes, can use mix-in mechanism. although more easier add annotation directly classes, if control classes of course. mapper.addmixinannotations(yourclass.class, typeinfomixin.clas

scala - Return JSON errors in akka-http API -

in api i'm writing, want take , return json, in cases of errors. i'm trying figure out how preserve of default rejectionhandler behavior, convert status codes , text json object. default behavior specified within function calls, rather data structure, seems way convert httpentity of result produces. there simple way this? you can write in httpservice private val defaultrejectionhandler = rejectionhandler.default implicit def myrejectionhandler = rejectionhandler.newbuilder() .handleall[rejection] { rejections ⇒ def prefixentity(entity: responseentity): responseentity = entity match { case httpentity.strict(contenttype, data) => { import spray.json._ val text = errorresponse(0, "rejection", data.utf8string).tojson.prettyprint httpentity(contenttypes.`application/json`, text) } case _ => throw new illegalstateexception("unexpected entity type") } mapresponseentity(pr

Is it possible to redirect HTML to javascript function? -

i have following html code : <div class="action-button"> <a href="/wp-login.php?loginfacebook=1&amp;redirect=http://blabla.com" class="mybutton">hello </a> </div> is possible call javascript function (stored in file) while redirecting instead of redirecting specific url ? the javascript file in same domain rest. thank you. you can query string. example <a href="http://blabla.com/mypage.html?callfunction=1">hello</a> then on page redirects (mypage.html) you'd like <script> if (getparameterbyname('callfunction') == 1) callmyfunction1(); </script> you pass parameters via querystrings. for more info on querystrings see-- how can query string values in javascript? function getparameterbyname(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new regexp("[\\?&]" + name + &qu

css - How to style secondary nav menu without affecting main nav? -

i added secondary navigation menu (above header) , it's dropdown menus same main navigation dropdowns. i'm wanting style them separately without messing main nav. ideas how this? i'm trying right align it. this test site . you've given secondary menu class of nav-secondary . result, can use alter styles of in menu via .nav-secondary .another-selector . example: .nav-secondary .sub-menu { color: blue; }

python - Find maximum value of a column and return the corresponding row values using Pandas -

Image
using python pandas trying find 'country' & 'place' maximum value. this returns maximum value: data.groupby(['country','place'])['value'].max() but how corresponding 'country' , 'place' name? assuming df has unique index, gives row maximum value: in [34]: df.loc[df['value'].idxmax()] out[34]: country place kansas value 894 name: 7 note idxmax returns index labels . if dataframe duplicates in index, label may not uniquely identify row, df.loc may return more 1 row. therefore, if df not have unique index, must make index unique before proceeding above. depending on dataframe, can use stack or set_index make index unique. or, can reset index (so rows become renumbered, starting @ 0): df = df.reset_index()

javascript - Execute C# code while using .load jquery -

again, i've looked around try find posts on , there many none address specific question (that find). what looking : have projects , loads different pages (.aspx) in iframe dynamically. trying remove iframe , add div , load aspx pages inside div, using : $("#containerdiv").load("test/default.aspx", function () { }); it loads aspx page unable execute c# code written in default.aspx.cs may not practice want know there solution of problem. $.load not c# code why because load contents of aspx page not of aspx.cs . use user controls instead. if need how implement user control refer this link.

Is there a way a spring cloud config client can decrypt cipher text fetched from a config server? -

our config server relatively insecure , handful of clients need encrypted properties. ideally, want server have public key , each client can use private key decryption. trouble default, config server attempt decrypt cipher text you. prevent that, disabled default behavior so: @springbootapplication(exclude = encryptionautoconfiguration.class) @enableconfigserver public class configserverapplication { public static void main(string[] args) { springapplication.run(configserverapplication.class, args); } } now when client application fetches properties config server, gets this: "source": { "username": foobar, "password": "{cipher}cibnmk+y3zlsxhvgajmaiunylqo3p0e..." } i've implemented textencrypter bean , tested make sure works on client. on client application startup, expect environmentdecryptapplicationinitializer class process client's local bootstrap , application properties fetche

.net - Global regex match timeout works in console application, but not in ASP.NET MVC app -

i'm trying use .net 4.5's new regular expression match timeout , global variant via appdomain.currentdomain.setdata "regex_default_match_timeout" property (the variant whereby pass timespan regex constructor works fine). when create new console application main method: static void main(string[] args) { appdomain.currentdomain.setdata("regex_default_match_timeout", timespan.fromseconds(3)); var m = system.text.regularexpressions.regex.match( "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "^(x+x+)+y$"); } it works expected: after 3 seconds, throws regexmatchtimeoutexception . however if create empty mvc 4 app, add homecontroller , action method: public actionresult index() { appdomain.currentdomain.setdata("regex_default_match_timeout", timespan.fromseconds(3)); var m = system.text.regularexpressions.regex.match( "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "^(x+x+)+y$&quo

GWT Module Design -

i have app 2 components. customer facing 1 submitting restaurant orders. vendor facing 1 viewing restaurant orders. should have 2 modules different entry points there no shared code(except domain model objects) between components? my choice of design( using mvp ): 1)single module 2)same login page (user pojo must have type i.e vendor or customer ). 3)in onmoduleload based upon type i'l open corresponding vendor or customer presenter why?? 1)code re-usability. 2)reducing maintenance of 2 modules. well,i waiting see more design options. please refer

c++ - What does cv::TermCriteria() exactly do in OpenCV? -

official documentation said termcriteria(int type, int maxcount, double epsilon) defining termination criteria iterative algorithms. , criteria type can 1 of: count , eps or count + eps . however, can't quite understand svm different in each iteration when use svm->settermcriteria(const cv::termcriteria & val) . svm training can considered large-scale quadratic programming problem , unfortunately cannot solved standartd qp techniques. that's why in past several years numerous decomposition algorithms introduced in literature. the basic idea of these algorithms decompose large qp problem series of smaller qp sub-problems. is, in each iteration algorithm keeps fixed dimension of optimization variable vector , varies small subset of dimensions (namely working set) maximumal reduction of object function. as far know, opencv uses svmlight or generalized smo algorithm , termcriteria parameter termination criteria of iterative svm training procedure sol

C# I'm using string arrays, and I was hoping to use a "foreach" to Display a list of them -

i believe of code correct part aside foreach statement. haven't been able test due fact program isn't compiling. i'd appreciate , help, if structure needs change somewhat. private static void pickscreen(human myhuman) { var tries = 3; bool answer = false; string choice= ""; string[] choices = new string[6]; choices[0] = "name"; choices[1] = "age"; choices[2] = "scar type"; choices[3] = "weapon"; choices[4] = "hero status"; choices[5] = "potions"; displaynewscreenheader(); console.writeline(" screen go to?"); console.writeline(); foreach (string in choices) { console.writeline(" screen choice: {0}", choices[]); } console.writeline(); console.writeline(" or can type in " + "\"default\""

android - how to invoke c++ code from phonegap -

what have understood through phonegap plugin can invoke native apis. http://docs.phonegap.com/en/2.1.0/guide_plugin-development_android_index.md.html#developing%20a%20plugin%20on%20android question: is possible invoke c++ function directly phonegap, middle lever layer going c++, , applicable both ios/android. no, not directly. have write plugin calls c++ code. on android you'd writing plugin in java , using jni call c++ lib. on ios created plugin in obj-c , call c++ code. here answer on https://stackoverflow.com/a/4456290/41679

PowerPivot DAX - Dynamic Ranking Per Group (Min Per Group) -

i searching method utilize within microsoft powerpivot 2010 allow me perform dynamic ranking automatically update associated rank value based on filters , slicer values applied. thusfar, examples have seen utilize calculate() dax function overrides existing filters within powerpivot table via all() function causes predefined filters users may apply disregarded. to illustrate requirements, please reference example below: (source data within powerpivot window:) ------------------------------------------------------------------------------------- claim number | claimant number | transaction date | dollar amount ------------------------------------------------------------------------------------ abcd123456 4 1/1/2012 $145.23 abcd123456 4 8/1/2012 $205.12 abcd123456 4 9/1/2012 $390.74 vdsf123455 2 3/5/2012

Get output variable name from load function load in Matlab -

i want load ascii-file using syntax: load('10-may-data.dat') the returned output variable name should x10_may_data . is there way variable name in matlab? if want use regular expression translation, how can it? example, put x before underscores or digits in filename , replace other non-alphabetic characters underscores. the who function returns names of variables in matlab. has built-in regexp selecting items: x10_may_data = [1 2 3]; save x10_may_data.mat x10_may_data clear load x10_may_data.mat w = who('-regexp','x*') w = 'x10_may_data' you can operate on w{1} substitutions want. example, use strrep function simple modifications of string: newvar = strrep(w{1},'may','latest') newvar = x10_latest_data for more complex modifications, use regexp or regexprep . when have new name, can assign eval : eval([newvar '=' w{1}]) % typing "x10_latest_data = x10_may_data" x10_latest_data

wordpress - text-align justify bug on ie internet explorer and android -

Image
i have bad justify effect on internet explorer , android wordpress content : lines got big spaces between words , tiny space between last 2 words of line it works fine on other browsers ie chrome/firefox/safari. platform : wordpress 3.5 + visual composer plugin someone got idea ? here content : http://www.arkama.fr/offres/sap/assistance-technique/ it visible on line •la recherche et l’identification de <ul style="text-align: justify;"> <li style="text-align: justify;">la bonne <strong>qualification</strong> du besoin client ;</li> </ul> <ul style="text-align: justify;"> <li style="text-align: justify;">la <strong>recherche</strong> et <strong>l’identification</strong> de ressources disponibles et adaptées ;</li> </ul> <ul style="text-align: justify;"> <li style="text-align: justify;">la <strong>validation du pr

multithreading - How does OpenMP works internally -

i tried write small c program figure out how openmp works. example supposed compute sum of 1 1000; however, printed out 0 in terminal. can desired result after commenting #pragma stuff out. can possibly tell me reason? this guide says #pragma omp for divides work of for-loop among threads of current team. not create threads, divides work amongst threads of executing team. should have 1 main thread throughout execution, correct? #include <stdio.h> int main() { int n, sum = 0; #pragma omp (n = 0; n <1000; n++) { sum += n; } printf("%d\n"); return 0; } you have several issues such simple example... 1) not starting parallel region. this, use omp parallel for instead of omp for . 2) variables not being made private each thread working on different loops. each thread over-writing each other thread's version of variables. n needs made private. 3) attempting sum 1 shared variable across multiple threads. must done redu

Dns records on directadmin for drupal site -

Image
i've drupal6 site , use directadmin panel. problem people can enter site by; www.mydomain.com pop.mydomain.com smtp.mydomain.com mail.mydomain.com why occuring? know can redirect want solve problem. please me.. this happens when have added multiple sub domains a (or cname )records main domain. removing them remove unwanted sub domains. wildcard pointers, example, *.domain.com .

Solr Spell checker Filter query -

i trying build spell checker on top of solr. basic information looks enough http://wiki.apache.org/solr/spellcheckcomponent#introduction can somehow limit scope of spell checker specific query. e.g want spell checker correct spelling genre=international. (genre text field defined in schema.xml) edit to make question more precise: how can filter query spell checker component. fq=genre:music&query=jacksn then spell corrector should document have genre:music do want restrict dictionary building single field? if can modify solrconfig.xml , set dictionary source "genre" field: <searchcomponent name="spellcheck" class="solr.spellcheckcomponent"> <lst name="spellchecker"> <str name="name">default</str> <str name="classname">solr.indexbasedspellchecker</str> <str name="field">genre</str> edit: have multiple countries , have different

mysqli - PHP add function in EOF -

this question has answer here: calling php functions within heredoc strings 17 answers i need add function result id in eof see line in page , not work function. how fix this?! {design_num('61')} my php: $stmt->bind_result($id,$first_name, $last_name); $content = <<< eof <tr> <td style="text-align:center;">{design_num($id)}</td> <td style="text-align:right;"><a href="#">{$first_name}</td> <td style="text-align:right;">{$last_name}</td> </tr> eof; it's feasible, need powerful magic accomplish task $design_num = design_num($id); $content = <<< eof <tr> <td style="text-align:center;">$design_num</td> <td style="text-align

javascript - AJAX post data undefined? -

i'm trying make ajax post request root directory on express server. when use html form , submit artist name, response , can send information client fine... see res.send(tourdetails); when run code this, json array back, , i'm go. var express = require('express'); var app = express(); var bodyparser = require('body-parser') app.use(bodyparser.json()); // support json-encoded bodies app.use(bodyparser.urlencoded({ // support url-encoded bodies extended: true })); var tourschedule = require('./artist_profile.js'); app.use('/public', express.static(__dirname + '/public')); app.set('view engine', 'jade'); app.set('views', __dirname + '/views'); app.get('/', function(req, res){ res.render('layout.jade'); }); app.post('/', function(req, res){ var artistname = req.body.artist_name; var tour = new tourschedule(artistname); tour.on('end', f

c# - Dependencies and DLL in Visual Studio Installer -

i using vs2010's visual studio installer deploy application msi . i referenced numerous dlls during development; 3rd parties, while system dlls. during deployment, not know include or exclude. visual studio automatically included detected dependencies after added output .exe not sufficient run application. had manually include development's dlls installed application folder. otherwise, eventvwr provides generic clr20r3 error tells me missing dlls not indicating one. it became habit (a bad habit, imo) include references in deployment project referenced in development project, guess uninstallation of application may possibly remove system dlls causes problems other application. so how know dlls include manually in deployment project, in addition detected dependencies ? all of thirdy party dlls need distributed application. need check documentation of these libraries precise answer. as rule of thumb, @ references section of projects. note down librarie

javascript - d3.js margin convention -

Image
please see margin convention described here chart only: http://bl.ocks.org/mbostock/raw/3019563/ two issues if download html file gist ( link ), below view (google chrome version 26.0.1410.43 ) there no border around svg, , axis line/path not shown. surprised lack of axis path within svg container. wrong? as shown in image, arrow @ top-left corner indicates translate(margin.left, margin.top) . but, guess translate(padding.left, padding.top) . margin rect between origin , svg element. mistake?

ios - Cocos2d 2.0: I get a higher memory allocation peak setting default pixel format to kCCTexture2DPixelFormat_RGBA4444 -

Image
i getting kind of crazy. got appdelegate lunch introduction scene. used texturepacker plist , png file using rgba4444 pixel format , set in xcode "no" option "compress png files" in order preserve optimized files. my appdelegate configured default pixel format of keaglcolorformatrgb565: ccglview *glview = [ccglview viewwithframe:[window_ bounds] pixelformat:keaglcolorformatrgb565 //keaglcolorformatrgba8 depthformat:0 //gl_depth_component24_oes preservebackbuffer:no sharegroup:nil multisampling:no numberofsamples:0]; scenario 1: run appdelegate , push introduction scene without changing default pixel format (in other words, leaving default appdelegate settings) , following allocation analysis. blue peak corresponds 16 mb memory allocation in introductionscene when creating fir

r - as.Date() does not respect POSIXct time zones -

okay here subtle "quirk" in r as.date function converting posixct timezone, wondering if bug. > as.posixct("2013-03-29", tz = "europe/london") [1] "2013-03-29 gmt" > as.date(as.posixct("2013-03-29", tz = "europe/london")) [1] "2013-03-29" so far no problem, but..... > as.posixct("2013-04-01", tz = "europe/london") [1] "2013-04-01 bst" > as.date(as.posixct("2013-04-01", tz = "europe/london")) [1] "2013-03-31" anybody seen this? bug or quirk? april fools? the default time zone as.date.posixct "utc" (see page). try as.date(as.posixct("2013-04-01", tz = "europe/london"),tz = "europe/london") .

entity framework - EF5 Code First Fluent EntityTypeConfiguration for tracks & albums models -

i modeling music tracks , albums albums have many tracks , tracks can on 1 album, join table specify it's position in album listing. here models: public class track { public int id { get; set; } public string name { get; set; } public int albumtrackid { get; set; } public virtual albumtrack albumtrack { get; set; } } public class album { public int id { get; set; } public string name { get; set; } public virtual icollection<albumtrack> albumtracks { get; set; } } public class albumtrack { public int albumid { get; set; } public virtual album album { get; set; } public int trackid { get; set; } public virtual track track { get; set; } public int position { get; set; } } and entitytypeconfiguration public class albumtrackconfiguration : entitytypeconfiguration<albumtrack> { public albumtrackconfiguration() { // albumtrack has composite key haskey(at => new {at.albumid, at.trackid

Determining Cause of Suspended Website on Windows Azure -

i have website hosted on windows azure. website custom asp.net mvc 4 site hosted shared web site instance. within past couple of days, i've started large spikes in cpu time. these spikes have been sustained , have caused web site suspended. however, i'm not sure how determine cause of these spikes. here i've done far: i attempted @ diagnostics via windows azure ftp drop. did not see there. i reviewed google analytics see if there out of ordinary. site had 20 visitors yesterday. nothing crazy. how can identify culprit of the cpu spike? once spikes, sits there hours. i'm not sure cause this. thank you have tried running site on local box , simulating visitor traffic, exercising website's features? testing locally 1000's of times easier , more revealing trying debug site that's running live. if still can't find wrong when running locally, consider using logging , tracing strategic points in site can see how often, , how long takes

Changing value of button using typescript -

i'm trying make button (which says "add favorites) change "remove favorites" once it's clicked. i've tried lot of solutions on site (for both java , textscript), nothing seems working. my code: button(id='addtofav', onclick='addtofavorites()') add favorites script. function addtofavorites(){ var x = document.getelementbyid("addtofav").value; if (x=="add favorites") { x = "remove favorites"; } else { x = "add favorites"; } } thank help! assigning new text "x" not update button text. assign this. function addtofavorites(){ var x = document.getelementbyid("addtofav").value; if (x=="add favorite") { document.getelementbyid("addtofav").value = "remove favorite"; } else { document.getelementbyid("addtofav").value = "add favorite"; } }

ipc - Can D-Bus be configured to persist messages to a durable store? -

it's possible use various implementations d-bus queue messages , defer delivery until receiver/subscriber has connected/received them. messages internally queued somewhere (a unix domain socket in implementations, think). is there way configure d-bus such queued messages persist across restart of d-bus daemon or across reboot of host running bus? for example, if publish bunch of messages , consumers still chewing through message queue when dbus daemon shut down or system restarted, messages should persist , able re-delivered when system comes up. if there additional setup/manual reconfiguration of dbus needed hooked persistent message store, fine. if possible (and may not be), i'd prefer avoid having additional services running hooked dbus persistence. if that's way message persistence, that's fine, i'd keep setup simple possible if can.

Overwritten Github key? -

i new github may seem trivial. supposed create ssh key github account. did typing following command git shell: ssh-keygen -t rsa -c "rishikesh.330@gmail.com" prior this, had deleted ssh key github.com , had no keys in github before running above command. on running above command, key generated. when opened github.com again, saw key, assume one. however, accidentally deleted key github.com , added new key had created on git shell. so mean github.com online account , desktop git shell/git bash have 2 different ssh keys now? should concerned if intend use git bash upload things github.com ? if you've applied key, you've applied account. so, if you're using git shell, can connect account using ssh key created in shell , you've applied github putting in public part of key. doesn't matter client you're using connect. go ahead. if need private key @ stage when you're connecting, use private part of key public part added github.

getting exception in updating data base sqlite in android -

to update row in data base when press button public void updatecontact(long id, string x, string y,string angle) { contentvalues editcon = new contentvalues(); editcon.put(key_x, x); editcon.put(key_y, y); editcon.put(key_angle, angle); ourdatabase.update(database_table, editcon, key_rowid + id, null); } and use entry.updatecontact(1, double.tostring(db1), double.tostring(db2), double.tostring(db3)); but exception: no such colum: _id1 (code1): , while compiling: update savedtable set position_y=?, position_x=?, position_angle=? where_id1 even though have database 1 row ( create entry in oncreate method of main activity) key_rowid + id not work expect! key_rowid string containing _id , id variable contains 1 result in _id1 . you need this: ourdatabase.update(database_table, editcon, key_rowid + "=" + id, null); or better: ourdatabase.update(database_table, editcon, key_rowid + "=?

c++ - Allocated memory release before end of program -

the program i'm writing sudoku puzzle. each puzzle 2d array of struct, each struct int , bool. bool represents if number in each element of array clue or not, clues cannot changed. sorry huge blocks of code. pared down as possible easy readability. there missing function showboardans sudoku.h. same showboard, in different colors. after first time program displays puzzle (using showboard sudoku.h), appears both puzzle , comp deleted memory. after entering number answer (say 1 x, 1 y , 1 answer), when board printed again, either holds garbage or not print except outline. when debugging using visual studio, puzzle , comp start hold garbage rather numbers program assigned. far can tell, happens after program goes main sudoku after displaying puzzle first time. #ifndef sudoku_h #define sudoku_h #include <iostream> #include <windows.h> // header file needed change text color of console using namespace std; class sudoku { protected: struc

Yet another static array initialization in C++ -

i have following code in c++ (c++11 available) typedef enum { apple, orange, last, } fruits_t; template <typename t, size_t size> char (&arraysizehelper( t (&)[size]))[size]; #define arraysize(parray) sizeof(arraysizehelper(parray)) static const char *lookup_table[] { "apple", // apple "orange", // orange }; // fail compilation if lookup table missing static_assert(arraysize(lookup_table) == last, "update lookup table"); i want able change order in enumeration without changing initialisation list in lookup_table. i have read initialization of normal array 1 default value , template need, not quite. struggled metaprogramming half day , still can not figure out how it. the actual enumeration in code starts 0 , contains 20-30 entries. have considered hash table - hash function trivial, problem of initialization remains. have many - 5+ - lookup tables in code. worth struggle? p.s. after couple of answers around s

c# - Document.Protect is not working -

hi have created 1 asp.net application, in converting asp:panel word document using below code snippet. stringwriter sw = new stringwriter(); htmltextwriter htw = new htmltextwriter(sw); tblmain.rendercontrol(htw); if (strtype.equals("save")) { string filename = datetime.now.tostring().replace("/", "").replace("-", "").replace(":", "").replace(" ", "") + ".doc"; string strpath = server.mappath("attachments") + "\\" + filename; streamwriter swriter = new streamwriter(strpath); swriter.write(sw.tostring()); swriter.close(); now file saving specified folder. after fetching same file appending password protection. , used below code same. microsoft.office.interop.word.applicationclass wordapp = new microsoft.office.interop.word.applica

android - Viewpager pages with different layouts but same fragment class -

using viewpager, i'm working on guide tells user how use app. this how add/setup pages: ... private class screenslidepageradapter extends fragmentstatepageradapter { public screenslidepageradapter(fragmentmanager fm) { super(fm); } @override public fragment getitem(int position) { switch (position) { case 0: return new guide_fragment(); case 1: return new guide_fragment_2(); case 2,3,4 etc. default: return null; } } ... but way have have fragment class each page, , since pages images , text, figured might not necessary. is there way can use same fragment class pages , assign different layouts it? thanks is there way can use same fragment class pages , assign different layouts it? sure. pass data fragment indicating display, typically via factory pattern: create static newinstance() method takes data might ordinarily pass

haskell - Pipes.Concurrent: Sent signal is delivered one click later than expected -

i'm using pipes.concurrent write short gui program gtk. it's minesweeper-esque game, i'm constructing grid of buttons. i construct , connect buttons with: b <- buttonnewwithlabel (show $ adjacencies board ! i) on b buttonactivated $ void . atomically $ send output (clicksignal (mines board ! i)) return b and connect pipe with: (output, input) <- spawn (latest (clicksignal 0 false)) let run = sig <- await case sig of clicksignal ismine -> if ismine lift $ labelsettext info (show ++ " -- lose!") else lift $ labelsettext info (show ++ " -- ok") run empty -> lift $ labelsettext info "empty case" run void . forkio $ runeffect $ frominput input >-> run performgc it runs almost expected. if click on button 1, nothing hap

c# - Winform Customer ListBox How to Suspend OnPaint method -

i have custom listbox inherits winforms listbox class, so. public class userlistbox : listbox { protected override void onpaint(painteventargs e) { // omitted brevity... } } i add filter on listbox (just gridview control's defaultview) when change items, onpaint method called regardless. cannot call other method remove. i test sendmessage wm_setredraw suspend update, isn't working. how can suspend call onpaint method? original i'm not sure why ever want this, possible. winforms can p/invoke native calls , attempt manage things windows messaging loop . in honesty, suggest trying avoid doing this. you're trying accomplish? how can suspend control.onpaint method? follow link check out example. update according msdn documentation, you're doing correctly. please provide more source code such have look?

vb.net - No Class files being generated from Adding a Reference to Web Service -

i'm integrated our website 3rd party site , using web service authenticate. i'm using visual studio 2010 visual basic , i'm able use url gave me add web reference using: website -> add web reference -> url -> go -> add reference however, after there aren't class files generated in file structure reference? the files generated are: .discomap .disco .wsdl .xsd .wsdl .xsd .xsd i don't know if relevant, webservice made using visual studio 2008. every tutorial have read online has said class files should generated after reference added. reading things wrong or else amuck? thanks! i ended having generate class file visual studio command line. same link used add web reference link needed command line text. this generated 2 files, class file , output.config file. had combine output.config file web.config file , webservice called correctly.

android - Separate apks for same app for Phone and Tablet on Google play -

i have app has 2 different designs depending on device. want keep orientation lock (landscape on tablet , portrait on phone). decided create separate apks , upload on google play , users download app depending on device have. approach advisable? if yes, steps can follow make sure works fine? any appreciated. the google play developer console provides 2 modes managing apks associated application: simple mode , advanced mode. can switch between these clicking link @ top-right corner of apk files tab. simple mode traditional way publish application, using 1 apk @ time. in simple mode, 1 apk can activated @ time. if upload new apk update application, clicking "activate" on new apk deactivates active apk (you must click save publish new apk). advanced mode allows activate , publish multiple apks each designed specific set of device configurations. however, there several rules based on manifest declarations in each apk determine whether you're allowed activat