Posts

Showing posts from January, 2012

What is the most elegant way to print breadcrumbs on a website? -

i've been thinking long time already. best, or elegant, way of creating breadcrumbs? one way have method called controllers. this: function showusers() { $this->breadcrumbs->add('users', url::route('admin.users')); // ... } i don't way, though, because i'd separate breadcrumb-logic controllers. also, if i'd e.g. have admin panel -item many pages inside controller, i'd need either define in constructor or in every controller method. another way utilize named routes, breaking them segments. requires routes sensibly named , structured in way. here's pseudocode: if($segment[0] == 'admin') { $breadcrumbs->add('admin panel', url::route('admin'); if($segment[1] == 'users') { $breadcrumbs->add('users', url::route('admin.users'); } elseif($segment[1] == 'foo') { $breadcrumbs->add(...); } } one issue approach it's hard "da

making jquery object from variable does not fully work -

i'm pretty new jquery , encountered problem. use $() make variable jquery object. somehow, not work expected (i'd expect can access jquery methods object). here did: $(function() { var form = "<div id='menu-box'></div>"; $(form).appendto('body').css({'backgroundcolor': 'blue'}); // line works $(form).css({'backgroundcolor': 'red'}); // line not. }); i'm using jquery-1.9.1, bug or did wrong. each time write $(form) , new jquery object constructed wraps newly-created <div> . second time happens, operating on element has not been inserted dom. consolidate 2 usages instead desired result (although of course not make sense "real" code): var $form = $("<div id='menu-box'></div>"); $form.appendto('body').css({'backgroundcolor': 'blue'}); $form.css({'backgroundcolor': 'red'});

spring security - How to add arguments to constructor of BCryptPasswordEncoder to make it stronger? -

i have bcryptpasswordencoder implemented on spirngsecurity, @ present using simple constructor without argument, how can make stronger? following question , tried use random , 512 strength not find declared namespace. <beans:beans xmlns='http://www.springframework.org/schema/security' xmlns:beans='http://www.springframework.org/schema/beans' xmlns:xsi='http://www.w3.org/2001/xmlschema-instance' xsi:schemalocation='http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd' xmlns:c='http://www.springframework.org/schema/c'> ..... </authentication-manager> <beans:bean id='bcryptpasswordencoder' class='org.springframework.security.crypto.bcrypt.bcryptpa

c# - How can I use my own application bar with tilt effec? -

for windows phone 8 application, i'm implementing own application bar (i can't use application bar provided system). working fine, have 1 big problem: tilt effect menu items! i've tried used tilt effect provided wp toolkit, doesn't original one. how can use exact tilt effect system application bar in own application bar ? thanks. because own app bar not tiltable item. can tilteffect.cs file link: http://code.msdn.microsoft.com/wpapps/tilt-effect-sample-fab3b035 and should add own app bar tiltableitems in tilteffect's constructor, this: static tilteffect() { // tiltable items list. tiltableitems = new list<type>() { typeof(buttonbase), typeof(listboxitem), }; tiltableitems.add(typeof(border)); tiltableitems.add(typeof(tilteffectablecontrol)); uselogarithmicease = false; }

php - Pass JS Array to server through $.ajax call -

here piece of code : $('#addtype').on('submit', function(e) { $form = $(this); var type = []; $(this).find('input[type=number]').each(function() { type[$(this).attr('id')] = $(this).val(); }); console.log(type); $.ajax({ type: 'post', url: '<?php echo $this->url(array(), 'addtype');?>', data: {type: type}, success: function() { $form.find('input[type=submit]').attr('disabled','disabled'); } }); e.preventdefault(); }); as can see, builds javascript array input s in form#addtype , send server side script supposed handle array. problem no data passed through $.ajax({}) . update it seems comes values of array keys cannot litteral. if put incremented number key, array passed. how come? make type object, not array: var typ

Rails: time_select helper validation on previous given time? -

i know if there built-in functionality of rails time_select , handles valid range of end_time. i have start_time , end_time . end_time not allowed "smaller" start_time . <%= f.time_select :start_time, {minute_step: 15}%> how can realize this? thank help. it seems can't specify range via time_select . option cut end_time range using javascript based on start_time value , add custom validation reliability: http://guides.rubyonrails.org/active_record_validations.html#custom-methods . def end_time_validity if end_time < start_time errors.add(:end_time, "can't before start time") end end

java - Replacing single quotes with double quotes in Android database insertion statement -

suppose have execquery statement this: db1.execsql("insert "+table_name+" values('"name"')"); where name string variable contains apostrophe. example: name = "tom's database"; in case, sqliteexception near statement. because of single quote. how modify such statement not cause crash , name stored in db single quote intact? i read online every such single quote has prefixed single quote. can provide code same? escaping special character in string literal works it's error prone approach. it's better use ? placeholder , bind arguments, this: db1.execsql("insert " + table_name + " values (?)", new string[] { name }); or use insert() contentvalues same.

javascript - Returning String value from Android Activity to JS function -

i trying return string value js function android activity. js function first calls android activity method , method return string value not working ... take on code <script type="text/javascript"> function picmethod(){ var path = activity.getpic(); alert(path); } </script> here android activity method public string getpic() { string temp="abcd"; return temp; } depending on use case, there different ways of accomplishing this. difficulty lies in want things in onload method. if possible pass in string after page loaded, use string jsstring = "javascript:adddata('" + thestring + "');"); webview.loadurl(jsstring); if need data accessible on onload method of page, modify url called to include query data if possible. like: string urlwithdata = yoururl + "?data=" + thestring; webview.loadurl(urlwithdata); and use standard javascript parse window.location.search dat

swing - java.awt.EventQueue.invokeLater explained -

i curious why have use java.awt.eventqueue.invokelater control swing components. why can't in normal thread? going on behind scenes? have noticed if have jframe can set visibility true or false main thread without getting errors, , seem work. achieve using java.awt.eventqueue.invokelater ? aware can use swingutilities.invokelater explained here , seem 1 , same thing. thanks explanation. valid question. edit: answer wumpz question can create jframe jframe frame = new jframe("hello world"); frame.setsize(new dimension(300, 300)); frame.setpreferredsize(new dimension(300, 300)); frame.setmaximumsize(new dimension(300, 300)); frame.setminimumsize(new dimension(300, 300)); frame.setvisible(true); frame.pack(); frame.setdefaultcloseoperation(windowconstants.exit_on_close); and on same thread created following. for (int = 0; < 34; i++) { system.out.println("main thread setting "+(!frame.isvisible())); frame.setvisible(!frame.isvisible());

.net - Can't transform Linq to IEnumerable -

i have method on dal class: public ienumerable<pedidos> pedidos_listar() { using (var context = new ohmioentities()) { var _ped = pedidos in context.pedidos pedidos.id_cliente == 1 select new {pedidos.id_pedido, pedidos.fecha, pedidos.clientes}; return _ped.tolist(); } } and vs give error: error 3 no se puede convertir implícitamente el tipo 'system.collections.generic.list<anonymoustype#1>' en 'system.collections.generic.ienumerable<ohmio.modellayer.pedidos>'. ya existe una conversión explícita (compruebe si le falta una conversión) what i'm doing wrong here?thanks edit more info: pedidos defined pocos db class work fine: public ienumerable<pedidos> pedidos_listar() { using (var context = new ohmioentities()) { return context.pedidos.tolist()

oop - Java design pattern for notifications -

i have web based application sends messages client server every time action has been performed in backend. now, i'm writing few tests see if messages being sent client expected messages. each action, when executed, generates message sent across client. in test, i've created websocket client listen server. when perform action, should check whether expected message action being sent. note server takes time send message. the following pseudo code: class applicationtest public void checkifeventcreatedmsgissent() { application.createnewevent("id101"); // wait till application sends message client // , check message sent correct 1 // if (expectedmessage == recievedmessagefromclient) { // success(); // } } class client public void readmessage(message message) { // received new event message id101 // message should sent applicationtest.checkifeventcreatedmsgissent , confirmed } } i

optimization - Why bother allocating activation records at runtime when you could perform an inline expansion of all recursive function definitions at compile time? -

note have read question why not mark inline? and can recursive function inline? yet still feel there unresolved edge case of interest here. assume language has following: pure first-class functions parameters treated constants (no write-back) anonymous inline functions supported (lambda abstraction) callbacks/continuations/coroutines/fibers patterns tail-call optimisation macro expansion then why bother allocating activation records @ runtime when perform inline expansion of (mutually) recursive function definitions @ compile time? seem reduce calling overhead zero, open opportunities parallel 'simplification' of expressions abstracted behind each functions using standard computer algebra techniques variables can remain unknowns during symbolic reduction - including evaluating multiple branches of condition speculatively , throwing away valid result (something made difficult von neumann bottleneck imposed stack-based approach). i appreciate not optimisat

asp.net - Master Page Contents aren't Same in All pages -

Image
i use master page in project.but master page contents not same in pages.in home.aspx page it's margin 0px , in other page isn't. texts bold , big size in 1 page , small in page. why occur? my master.master page code : <body style="margin:0px; text-align: left;"> <form id="form1" runat="server"> <div> <div class="auto-style1" style="background-color: #3399ff; height: 42px;"> <h2> <a href ="home.aspx"><asp:label id="homelabel" runat="server" text="home"></asp:label></a> <a href ="members.aspx" ><asp:label id="memberlabel" runat="server" text="members"></asp:label></a> <a href ="shared_files.aspx"><asp:label id="file_sharedlabel" runat="server" text="files shared"></a

Changing Local Storage directory in JavaScript -

i wanted ask: there method change "localstorage" (javascript) directory? don't want store informations user in browers' file because (by me) unsafe. so? how can change local storage directory? no. have no access filesystem. don't ever save user's information, save auth token allows them use account. private information saved on server unless user wants browser remember passwords. more dangerous storing user's information locally , unencrypted if gave browsers access our filesystem without asking permission.

android - Does a GCM-App really need a wakelock? -

i'm not quite sure how interpret sentences in gcm client documentation : the android.permission.wake_lock permission application can keep processor sleeping when message received. optional—use if app wants keep device sleeping. . if don't hold wake lock while transitioning work service, allowing device go sleep before work completes. net result app might not finish processing gcm message until arbitrary point in future, not want. and using wakefulbroadcastreceiver not requirement. if have relatively simple app doesn't require service, can intercept gcm message in regular broadcastreceiver , processing there. i'm not quite sure if app needs hold wakelock or not (or if requires service). push notification part quite important app , should not delayed more few minutes. there chance broadcastreceiver gets suspended before receiving data? is there chance broadcastreceiver gets suspended before receiving data? no. not control until e

apache - htaccess to redirect to Facebook Page temporally -

i wanna temporally redirect domain facebook page till have our website ready. how can that? checked examples , provides me 301 redirect. should doing 301 redirect? edit: <ifmodule mod_rewrite.c> rewriteengine on redirectmatch 302 ^ https://www.facebook.com/nomadhq </ifmodule> don't use 301 temporary redirect otherwise seo ranking messed later. use 302 instead this: redirectmatch 302 ^ http://facebook.com/mypage

android - If a class derives from Activity, why would it also sport an Activity decoration? -

this seems android standard: [activity(label = "jivetomturkey", mainlauncher = true, icon = "@drawable/icon")] public class hyperactivity : activity ...yet seems redundant - if hyperactivity inherits activity, why have tell compiler class activity? i found this: we mentioned earlier activities have registered in androidmanifest.xml file in order them located os, , activityattribute aids in doing that. during compilation, xamarin.android build process gathers attribute data class files in project , creates new androidmanifest.xml based on androidmanifest.xml file in project, attribute data merged in. bundles manifest resulting compiled application (apk file). by using c# attributes, xamarin.android able keep declarative information used register activity class definition. failure include attribute result in android not being able locate activity, since not registered system. here .

java - How to extract numbers? -

i have database that: stockcode stockname stockstart stockfinish stockcurrentnumber __________________________________________________________ 100 water 1 10 ? now how code looks this... stockcode stockname stockstart stockfinish stockcurrentnumber __________________________________________________________ 100001 water 1 10 001 100002 water 1 10 002 100003 water 1 10 003 100004 water 1 10 004 100005 water 1 10 005 100006 water 1 10 006 100007 water 1 10 007 100008 water 1 10 008 100009 water 1 10 009 100010 water 1 10 010 i appreciate if help sorry, edit, have 1 record, , want duplicated in range stockstart stockfinis

android - Adding Espresso to instrumentTest dependency when dagger is already included in compile dependencies -

i have gradle project (using gradle 1.9) , trying add espresso (from https://github.com/jakewharton/double-espresso ) project has dagger in compile dependencies. here dependency structure: dependencies { compile 'com.crashlytics.android:crashlytics:1.+' compile 'com.commonsware.cwac:merge:1.0.1' compile 'com.squareup.dagger:dagger:1.2.0' compile 'com.squareup.dagger:dagger-compiler:1.2.0' compile 'com.mcxiaoke.volley:library:1.0.+' compile 'com.google.code.gson:gson:2.2.4' compile 'com.squareup.okhttp:okhttp:1.5.0' compile 'com.android.support:support-v4:19.0.1' compile 'com.android.support:appcompat-v7:19.0.1' compile 'com.google.guava:guava:16.0' instrumenttestcompile('com.jakewharton.espresso:espresso:1.1-r2') { exclude group: 'com.squareup.dagger' exclude group:'com.google.guava', module:'guava' } instrumenttestcompile('com.jakewharton.espresso:

javascript - Turning input data into an array on a backbone model? -

using mongodb, , backbone models trying store input value array inside model? so @ barebones let's have small little form. <form id="send-message"> <input name="message" class="message"/> <button type="submit" class="send">send</button> </form> then in backbone code view contains form, submit data. using socket.io have code thats this. don't think posting full code view necessary, , prevent confusion. var marionette = require('backbone.marionette'), messagesview = require('./messages'), userslistview = require('./users_list'), socket = io.connect(); module.exports = chatview = marionette.itemview.extend({ template: require('../../templates/chat.hbs'), events: { 'submit #send-message': 'sendmessage' }, initialize: function() { var self = this; this.messagesview = new messagesview({ co

amazon web services - Delete vpc request leaves VPC in inconsistent state(aws-java-sdk) -

i have tried deleting vpc - private static void deletevpc(string vpcid) { deletevpcrequest deletevpc = new deletevpcrequest(); deletevpc.setvpcid(vpcid); ec2.deletevpc(deletevpc); system.out.println("deleted vpc"+vpcid); } it responds when log in aws console vpc still there #bad string attached vpc id (vpc-7d1bad12). why might happening ? 7d1bad12 hex string , not normal string. assume gave delete request , shortly logged system , saw vpc still existing. vpc deletion time consuming process , takes time before vpc deleted. when api says returned means sdk able send delete request , delete request asynchronous , therefore, returns immediately. if vpc empty after time should go away aws console.

SQL pivot query in Oracle -

i have table this: name----address----type----value finland color 120 finland wage 500 what want show color , wage values columns: name----address----color----wage finland 120 500 select * (select name, address, type, value table) pivot (sum(value) (type) in ('color', 'wage'));

lexer - Token for odd number of spaces -

i'm trying create token odd number of spaces. have token : { < space: " " > | < oddspace: <space> ((<space>)(<space>))* > } void start() : {} { <oddspace> } this fine 3, 5, 7...etc spaces, fails when try using once space. ideas why happening? see question 3.3 of javacc faq. http://www.engr.mun.ca/~theo/javacc-faq/javacc-faq-moz.htm#tth_sec3.3 there 3 golden rules picking regular expression use identify next token: the regular expression must describe prefix of remaining input stream. if more 1 regular expression describes prefix, regular expression describes longest prefix of input stream used. (this called "maximal munch rule".) if more 1 regular expression describes longest possible prefix, regular expression comes first in .jj file used. in case rule 3 applied. can rewrite start as void start() : {} { <oddspace> | <space> }

javascript - Functions not changing the second time its called Jquery/JS -

i'm new js , trying use functions call later different values. function seems applying first value in both instances. html <div class="quality"> <span id="quality" data-avgquality="28"></span> </div> <div class="cost"> <span id="cost" data-avgcost="50"></span> </div> js $(document).ready(function(){ var qualitydata = $("#quality").attr("data-avgquality"); var costdata = $("#cost").attr("data-avgcost"); function loaddata(id,data) { $("#"+id+"").animate({ "width" : qualitydata+"%" }, 1500 ); }; loaddata("quality",qualitydata); loaddata("cost",costdata); }); when run data value both comes 28%. change function loaddata(id,data) { $("#"+id+"").animate({ "width" : qualit

windows - Component Object Model - interface browser / explorer -

i have no idea com is, need use few methods via com. there com browser show methods inside gicen interface? name or guid or something. com stores soem metadata comments interfaces etc? interfaces defined in type library (.tlb file, can embedded in dll) described in (the ole/com object viewer can show them), hardly documented in it. others defined in windows headers (or in third-party library's headers). view actual documentation, best on msdn (or google interface name, works of time).

wcf - How do I solve 'System.OutOfMemoryException' -

i have windows service application. busy application. supposed run continuously looking things do. after runs while exception of type 'system.outofmemoryexception' thrown. it can happen @ different times paragraph: private shared function getunprocessedqueue() boolean try dim l_svcooa new svcitgooa.isvcitgooaclient(ooaprocessing.cglobals.endpoint_itgooa) dim l_ifilter new svcitgooa.clsfilter l_svcooa l_ifilter .filingtype = ooaprocessing.cglobals.filingtype end m_returnclass = .itgwcfooa(1, cglobals.databaseindicator, svcitgooa.eooaaction.getunprocessedqueue, l_ifilter, 71) return completedgetunprocessedqueue(m_returnclass) end catch ex exception exceptionhandling(ex, "getunprocessedqueue " & m_application) return false end try end function this using wcf service read queue. reads queue every 2 minutes see if new recor

composer update can't download package over ssh. I always get a SVN authentification error -

composer doesn't want download packages subversion server. problem occurs on ssh connection, on testing server. composer works on local machine. it seems svn uses bad credentials, taken kind of cache can't figure how make work. should ask me username , password, no? somebody can help?

C++ Accessing a list of Pointers to Objects members, through an iterator -

been banging head against brick wall sometime problem. hoping may able here. basically, game has inventory system number of different objects. there different classes derived base class object , use virtual functions in order have different behaviour same function call. originally, had list inventory list::iterator inviter. iterator call functions needed right object in inventory call base class functions. read answer reason because lose polymorphic nature when having list of pointers remedy it. so changed list , iterator object pointers , found out supposedly correct way access functions , variables of inventory objects. however, when these functions or variables accessed @ runtime, program has unhandled exception , breaks. this code causes issue.... header #include "object.h" #include <vector> #include <list> using namespace std; class player { public: player(); void additem(object); void printinventory(); list<object*>

applescript - Override master page items in indesign with applscript -

i'm running applescript adds page document, "override master page items" import text 1 of released text boxes. solutions i've found don't seem work reference active page number so possible this? set thelistoffilenames {"1", "2", 3", "4", "5", "5"} set thetargetfolder ((path desktop folder) & "catalogue") string repeat thecurrentfilename in thelistoffilenames set theimportfile thetargetfolder & ":text:" & thecurrentfilename & ".txt" tell application "adobe indesign cs3" tell active document make page override (master page items) -- here?? -- select textbox on page -- place theimportfile without showing options --end tell end tell save active document end tell end repeat tested in cs6, should work in cs3... tell application "adobe indesign cs6" tell active document

Cannot remove hashset in java -

this question has answer here: concurrentmodificationexception , hashmap 4 answers i got problem hashset, cannot remove hashset, , here code //take stopword list file public void stopwordlist(){ openfile("d:/thesiswork/perlengkapan/stopword.txt"); while(x.hasnext()){ string = x.nextline(); = a.tolowercase(); stopwords.add(a); } } //the method remove stopword public void stopwordremoval(){ stopwordlist(); //if word in streams set equal stopword, should removed for(string word:streams){ for(string sw:stopwords){ if(word.equals(sw)){ streams.remove(word); } } } but, gives me exception, says : exception in thread "main" java.util.concurentmodificationexception , me? :) you performi

eclipse - Android Support-Library -

i've created android app 4.1.2 , want version 2.2. what use class popupmenu , there no support in 2.2. searched google , found have import android-support-v7-appcompat project eclipse. in project buchappzweipunktzwei i've set library reference. added support-appcompat.jar build-path in android-support-v7-appcompat project. i following error: [2014-03-22 17:10:04 - buchappzweipunktzwei] c:\users\pascal\downloads\adt-bundle-windows-x86_64-20130917\adt-bundle-windows-x86_64-20130917\sdk\extras\android\support\v7\appcompat\res\values-v14\styles_base.xml:24: error: error retrieving parent item: no resource found matches given name 'android:widget.holo.actionbar'. [2014-03-22 17:10:04 - buchappzweipunktzwei] c:\users\pascal\downloads\adt-bundle-windows-x86_64-20130917\adt-bundle-windows-x86_64-20130917\sdk\extras\android\support\v7\appcompat\res\values-v14\styles_base.xml:28: error: error retrieving parent item: no resource found matches given name 'android:wi

c# - json newtonsoft : Deserialize Object containing a list of string -

i have following issue json : { "evts": { "evt": [ { "id": "123456", "key1" : "somekey", "categ": [ "cat1", "cat2", "cat3" ] } ]} } and c# class: public class myclass{ public string id { get; set; } public string key1 { get; set; } public list<string> categ { get; set; } } public class esobject1 { [jsonproperty("evt")] public list<myclass> evt { get; set; } } public class esobject0 { [jsonproperty("evts")] public esobject1 evts { get; set; } } } here call deserializer : esobject0 globalobject = jsonconvert.deserializeobject<esobject0>(json); but last code doesnt work, throws exception : system.argumentexception: not cast or convert system.string system.collections.generic.list 1[system.string].` instead of list<string> used string [] , string nothing

algorithm - How can I make a for loop in java for the computer to make a winning move in tictactoe? -

i trying figure out how can implement loop check if computer can make winning move on 3 3 tic tac toe, if computer should make move. above code should check whether of rows match condition, not sure missing. please me out. thanks. for(int = 0; < 3; ++i) { for(int j = 0; j < 3; ++j){ if(button[i][j].gettext().equals(button[i][j+1]) && button[i][j+1].gettext().equals("x")) { button[i][j].settext("o"); } } } thanks.

Namespaces with Phalcon -

Image
all controllers under namespace myapp\controllers so, documentation recommended, i've set default namespace it: $dispatcher->setdefaultnamespace('myapp\controllers'); but need not organize controllers in folders namespace them , have friendly urls like: /features/featurex/ , /wizards/featurex/ . example got myapp\controllers\features\featuresx , myapp\controllers\wizards\featuresx . i believe shouldn't considered modules right? they're custom routes, routing documentation can't tell how to: declare route defines namespace (e.g $router->add("/:namespace", ["namespace" => 1]); ) make above routing strategy used controllers. example, logincontroller , should remain in myapp\controllers namespace. maybe can achieve using 1 router or dispatcher each one. experienced phalcon developer please give me light here?! well, after time using phalcon can not flexible when decide use different approach found in project

java copy file on network drive -

i'm trying copy files network drive folder, can access them online. file looks this, example \\gvssqlvm\lieferscheine\20011023\volumed 5005.00000063.doc which can access in windows explorer, when type address in. and destination copy file be c:\program files\jbossas\server\default\deploy\root.war\tmp\volumed 5005.doc i run trouble copying file following code: string doc_dir = "\\\\gvssqlvm\\lieferscheine\\20011023\\"; string doc_file = doc_dir.concat(doc.getuniquefilename()); file source = new file(doc_file); string home_url = system.getproperty("jboss.server.home.url"); string home_dir = home_url.substring(5); // cut out preceding file:/ string tmp_dir = home_dir.concat("deploy/root.war/tmp/"); string dest_file = tmp_dir.concat(title); file dest = new file(dest_file); try { input = new fileinputstream(source); output = new fileoutp

javascript - multiple instances of html5 audioElement, can it be done with $(this)? -

how use use multiple instances of on 1 page e.g mysql while loop. if imagine multiple instances of below code, when click 'play' play first instance. need code similar these 3 lines : $('.play').click(function () { $(this).audioelement.play(); }); but here working code. (javascript) $(document).ready(function () { var audioelement = document.createelement('audio'); audioelement.setattribute('src', '<?php echo "http://www.2click4.com/mods/wall/uploads/".$rowsound[' file '].""; ?>'); $('.play').click(function () { audioelement.play(); }); $('.pause').click(function () { audioelement.pause(); }); }); (html) <div class="play">play</div> <div class="pause">stop</div> of course yes, need native dom element call function since jquery doesn't have idea native play method. should wo

Using Google App Engine with mobile apps and a web app -

i have started looking using google app engine project i'm developing. project have android , iphone app web application set of users can log into. have couple basic questions concerning use of google app engine... is possible use google app engine in conjunction own web app? or post web app on google app engine? i'd use web app , google app engine, or same thing? guess main point i'm not clear on. i'm kind of concerned putting of our data on google's servers , not directly owned myself. i'll have over? thanks help! edit: web app need have decent amount of functionality in addition mobile apps. google app engine projects only/mainly have mobile apps? google app engine includes google cloud endpoints android, ios , web clients. client web app can hosted on appengine or elsewhere. if host client web app in same application hosts cloud endpoints, authentication , data sharing easier achieve. yes, you'll have on putting of data on goog

java - Storing user credential data - on device & online -

i writing android application requires user create account , login in order access data pulled external source (and locally on device). trying write register code , stuck on best approach use. at moment, thinking should creating shared preferences store username , password on device , writing data external source via db call. so want workflow this: user opens application on device user presented splashscreen "login" , "register" buttons. user selects "register" , enters basic info (name,email,preferred username,password) user clicks register button onclick creates shared preference , connects db write user credentials. user re-directed main activity user closes app user opens app , automatically logged application. at moment have 2 classes, register.java contains ui , accountpreferences.java contains logic. best approach? also, creating shared preferences , creating separate db call here best solution? tried looking accountmanager fo

java - How do I show a splash screen in Android? -

i want show splash screen when app loads up, java code: imageview splash = (imageview) this.findviewbyid(r.id.splashscreen); splash.postdelayed(new runnable(){ splash.setvisibility(view.gone); }, 3000); but getting error "cannot resolve symbol" on postdelayed() call. "unexpected token" for }, 3000); finally, layout: <textview android:text="@string/hello_world" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <imageview android:id="@+id/splashscreen" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/splash" android:layout_gravity="center"/> logcat: 9:41:01 pm throwable read access allowed event dispatch thread or inside read-action (see com.intellij.openapi.application.application.runreadaction()) details: current thread: thread[app

erp - How to Understand Existing System -

i have work on existing erp has more 3000 tables , 400+ asp pages , 56+ aspx pages . this erp working perfect , have customization per management requirement. now facing issue start study of system. would know start whether db/ui or how map database table with ui or should way study type of big application.

python - Pandas calculate days elapsed and percent change -

i have df hierarchical index (id & date) , measure m. add 2 new measures df; first percent change of measure m prior observation , second days elapsed. within "window" of id (i.e. first observation within each id 0 both new measures) one way group id, differences want , sew new dataframe. suggestions on how better and/or in place welcome. new_df = pd.dataframe() grouped = your_df.groupby('id') grp_id in grouped.groups: grp = grouped.get_group(grp_id) grp["diff"] = np.concatenate([np.array([0]),np.diff(grp['m'].values)]) # differences of m grp["days_elapsed"] = np.concatenate([np.array([none]),days_elapsed(grp.index.values)]) # new_df = new_df.append(grp) and function elapsed days pandas timeindex: def days_elapsed(l): res= [] print l x in range(1,len(l)): res.append((l[x]-l[x-1])/np.timedelta64(1, 'd')) return res

Using transform and plyr to add a counting column in R -

i have two-level dataset (let's classes nested within schools) , dataset coded like this: school class 1 1 2 2 b 1 b 1 b 2 b 2 but run analysis need data have unique class id, regardless of school membership. school class newclass 1 1 1 1 2 2 2 2 b 1 3 b 1 3 b 2 4 b 2 4 i tried using transform , ddply, i'm not sure how keep newclass continually incrementing larger number each combination of school , class. can think of few inelegant ways this, i'm sure there easy solutions can't think of right now. appreciated! using interaction create factor, , coerce integer: transform(dat,nn = as.integer(interaction(class,school))) school class nn 1 1 1 2 1 1 3 2 2 4 2 2 5 b 1 3 6 b 1 3 7 b 2 4 8 b 2

win32gui - How to create this kind of GUI on windows -

Image
there win7 application can show progress bar on win7 task bar. i wondering how implemented. there win32 api can this? you should inhert cprogressctrl class , redraw control. handle wm_paint message painting control in onpaint function.

MySQL Query pagination with PHP -

how can add pagination system simple item display? , how can add pagination results filter? lost part , cant figure out! want apply css on menu too! here's code: <?php include('db.php'); if(isset($_post['filter'])) { $filter = $_post['filter']; $result = mysql_query("select * products product '%$filter%' or description '%$filter%' or category '%$filter%'"); } else { $result = mysql_query("select * products"); } while($row=mysql_fetch_assoc($result)) { echo '<li class="portfolio-item2" data-id="id-0" data-type="cat-item-4">'; echo '<div> <span class="image-block">

json - Append HTTP verb -

i have (json for) resource @ /api/foo/1/ {name: "foo", bar_pks: [10, 11, 12]} now want add api appending bar_pks . there no http verb appending can find. if patch /api/foo/1/ {bar_pks: [13]} , overwrite, not append. is there verb more consistent appending? if modify patch resource append, come bite me later? (i using django , tastypie, prefer language agnostic answer.) is there compelling reason not append on client side , use put/patch send updated value server? i see couple of options if you're dead-set on doing this: a post new uri gets interpreted append list. a query parameter on patch indicates changes should appended rather overwrite. neither of these options, , not endorse using them.

Which is better in terms of performance? "if else" or "Evaluate" statement in COBOL? -

which better in terms of performance ? " if else " or " evaluate " statement in cobol, when have lesser conditons check ? it seems have doubter op, here's example ibm enterprise cobol: 01 pic 9. procedure division. accept if equal 2 continue else continue end-if evaluate when 2 continue when other continue end-evaluate and here code generated. don't need know ibm mainframe assembler, have note things same: 000008 if 0002f8 d200 d0f8 8000 mvc 248(1,13),0(8) ts2=0 0002fe 96f0 d0f8 oi 248(13),x'f0' ts2=0 000302 95f2 d0f8 cli 248(13),x'f2' ts2=0 000306 4770 b126 bc 7,294(0,11) gn=4(

c# - How to Attach to Process Windows Commands? -

how run visual studio in debug mode while attaching w3wp.exe instances using windows commands? i have solution contains 3 wcf services. currently, manually have go there , attach debugger 3 w3wp.exe processes running wcf services on local iis. how automate process using windows commands? by "windows commands" mean command line? don't know wether "vsjitdebugger.exe -p" allows multiple processids... (see http://msdn.microsoft.com/en-us/library/3s68z0b3.aspx ) or may might of help: http://apavan.net/wordpress/?p=29

Android and regex to read substring -

i'm trying use regex in android application read substring. i'm using pattern , matcher, can't figure out how it. my input string is: javascript:submitform(document.voip_call_log,30,0,'xxxxx','',0,''); xxxxx variable number of digits. how can read 'xxxxx' using pattern , matcher? i'm not expert in regex , 1 should work you: string input = "javascript:submitform(document.voip_call_log,30,0,'5555','',0,'');"; pattern pattern = pattern.compile(",'(\\d*)',"); matcher matcher = pattern.matcher(input); matcher.find(); string out = matcher.group(1); system.out.println(out); proof http://ideone.com/wi6vb1

java - Eclipse empty parameter string -

Image
in menu run->run configurations of java applet under tab parameters, can't add parameter value empty. how can use empty string parameter java applet in eclipse? the parameters retrieved in applet getparameter(name); here's screenshot of parameter tab:

Breaking a single python .py file into multiple files with inter-dependencies -

i want split large python module wrote multiple files within directory, each file function may or may not have dependencies other functions within module. here's simple example of came with: first, here's self contained .py module #[/pie.py] def getpi(): return pi() def pi(): return 3.1416 obviously, works fine when importing , calling either function. split in different files init .py file wrap up: #[/pie/__init__.py] getpi import * pi import * __all__=['getpi','pi'] #[/pie/getpi.py] def getpi(): return pi() #[/pie/pi.py] def pi(): return 3.1416 because getpi() has dependency pi(), calling structured raises exception: >>> import pie >>> pie.getpi() traceback (most recent call last): file "<pyshell#7>", line 1, in <module> pie.getpi() file "c:\python\pie\getpi.py", line 2, in getpi return pi() nameerror: global name 'pi' not defined and fix issue, current

java - Reading from a text file into an array -

hi im trying hackerearth challenge sum of medians , involves me reading text file , storing values in array. first value has stored in variable n able the remaining values have stored in array. become stuck. have read each value line line , store in array . code have been trying working on cant see im going wrong. import java.io.bufferedreader; import java.io.inputstreamreader; class testclass { public static void main(string args[] ) throws exception { // read number of data system standard input. bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); string line = br.readline(); int n = integer.parseint(line); int = 1; int[] myintarray = new int[n]; // median sum long summedians = 0; int median = 0; while (i<n) //read 1 line file , parse integer //store value in array { myintarray [i] = integer.parseint(line); = + 1; // increment total numbers read } so said must increment through text file storing each val