Posts

Showing posts from March, 2012

How to go to next Edit text in android after enter value in first one? -

we enter value in first edittext . want when press done button cursor move next edittext . i tried , search on google nothing found. you can done button click , set focus next edittext first_edit_text.setoneditoractionlistener(new oneditoractionlistener() { @override public boolean oneditoraction(textview v, int actionid, keyevent event) { if(actionid == 0 || actionid== editorinfo.ime_action_done) { next_edit_text.requestfocus(); } return false; } }); edit : to fulfill requirement : public void setedittext() { edittext = new edittext[length]; (int = 0; < length; i++) { edittext[i] = new edittext(this); edittext[i].setid(i); edittext[i].setsingleline(); edittext[i].setimeoptions(editorinfo.ime_action_done); edittext[i].setoneditoractionlistener(new onedito

Custom Keyboard Text Fully Replacing The Text in a UISearchBar rather than Adding to it [iOS] -

i have simple application has had it's premise changed. used user tap on text field , come custom toolbar above keyboard, allowing user select custom buttons add text in text field. if user typed in john's , pressed wedding button, text field add wedding end john's wedding. i have changed ui incorporate new table view controller when user selects text field because have autocompleting occurring making easier user. have brought keyboard forward now, instead of custom button adding text in search bar, replacing it. so if type john in search bar , press wedding in custom keyboard, search bar's text gets replaced john wedding . not ideal , need fix this. here code: -(void)configurekeyboardtoolbars { uitoolbar *eventtoolbar = [[uitoolbar alloc] initwithframe:cgrectmake(0.0f, 0.0f, self.view.window.frame.size.width, 44.0f)]; eventtoolbar.tintcolor = [uicolor colorwithred:0.6f green

javascript - How to add pages a part of theme in Orchard CMS -

i need add cshtml/html both type of pages part of theme (i.e. inside theme folder) added in folder can use 1 page of theme i.e. layout.cshtml master page. other need add test pages need use put content & display. how display them? http://localhost:65012/themes/mytheme/demos/layout1.html this gives 'the resource cannot found' error. suggestions to able download static files need enable staticfilemodule of ii7, or staticfilehandler ii6. the fastest way copy web.config file folder media demos folder.

php - Error while trying to reach sitemap.xml -

i such error when trying reach sitemap.xml generated xml sitemap file , put in root folder on server when try acces following error: warning: require_once(/home/europezone/html/inc/pages.inc.php): failed open stream: no such file or directory in /home/europezone/html/index.php on line 44 fatal error: require_once(): failed opening required '/home/europezone/html/inc/pages.inc.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/europezone/html/index.php on line 44 the sitemap should have had .php format, solution add . php end sitemap.xml.php

java - Android runOnUiThread execution sequence -

runonuithread(new runnable(){ @override public void run() { system.out.println("print out runonuithread."); } }); system.out.println("print out in main thread."); **output:** print out runonuithread. print out in main thread. runonuithread used in background thread, doing testing only. the code above execute in activity oncreate method. from output, result not expect. thinking that, since runonuithread post runnable block main thread, , current execution context in main thread already, runonuithread should scheduled after "print out in main thread", why result doesn't show that? interpret wrongly? can kindly explain? edit: oh should read api first. anyway, why confuse me because, in ios, similar mechanism behave differently: dispatch_async(dispatch_get_main_queue(), ^{ nslog(@"main thread dispatch."); }); nslog(@"main thread."); the output of above reversed. r

java me - BackGround Proceess Example in Nokia J2me Applicationn -

i need j2me app run in background , still allow user use mobile without problem.the app still needs process events in background.i allow user stop app if wants to. music player 1 can me regarding issue. had tried calling display.setcurrent(null); not working in nokia sdks. there no apis offered 3rd party application run in background on nokia devices, using apis provided j2me

c# - Where do long running, stateful 'services' fit in DDD? -

in more industry or automation related applications (that heavily rely on external components have manage), you'll end case domain contains models more abstractions real problem, representations of , pointers physically exist outside of domain. for example, take domain entity represents network device: public class networkdevice { public ipaddress ipaddress { get; set; } } instead of storing or validating such entities or taking actions upon entity changes, application may need manage external components based upon representations inside domain. now, ddd suitable such cases? managers domain services? eric evans describes in famous blue book domain service needs stateless model implementing methods taken ubiquitos language fullfil request entity, or repository cannot handle itself. if service needs stateful ? a simple example: application needs monitor configured ip devices within network in order notify other application inside domain state events. if ip d

Add search command to windows startmenu -

how can add command "search internet" command in windows startmenu. image: http://i.stack.imgur.com/xpwez.png something "search wiki" browser-website called given search parameters. don't want show results directly in starmenu... thanks! you cannot. the windows shell team has, several releases now, restricted ways of extending things because has been terribly abused in past. imagine opening start menu , seeing dozen different search providers there got installed because can. if personal use can create program or batch file need arguments, type w foo , have open browser “the wiki” (whichever mean) searching “foo”. a broken such batch file be @echo off set "s=%*" start "" "http://en.wikipedia.org/w/index.php?search=%s: =+%"

mysql - Php - variable in variable name -

i have form several checkboxes. these boxes have 1 row each in mysql db if checked. now, need have loop build query delete rows not checked. tried 1 below array never populated... appreciated... $chk_cab_1 = isset($_post['chk_cab_1']) ?: 0; $chk_cab_2 = isset($_post['chk_cab_2']) ?: 0; $chk_cab_3 = isset($_post['chk_cab_3']) ?: 0; $chk_cab_4 = isset($_post['chk_cab_4']) ?: 0; $chk_cab_5 = isset($_post['chk_cab_5']) ?: 0; $chk_cab_6 = isset($_post['chk_cab_6']) ?: 0; $chk_cab_7 = isset($_post['chk_cab_7']) ?: 0; $chk_cab_8 = isset($_post['chk_cab_8']) ?: 0; $chk_cab_9 = isset($_post['chk_cab_9']) ?: 0; $chk_cab_10 = isset($_post['chk_cab_10']) ?: 0; $chk_cab_11 = isset($_post['chk_cab_11']) ?: 0; $check_cab = array(); $del_cab_ids = array(); for($i = 1; $i<=$counter; $i++) { $check_cab["chk_cab_$i"] = $chk_cab_$i; if($check_cab["chk_cab_$i"] ==

javascript - Using jquery to show/hide several table rows -

i trying create table of periods , prices. the table header includes select change currencies. table rows below shows different periods , prices. prices can shown according currency selected in select. i new jquery, have been fiddling around , looked through many posts here, lot of have helped me far! but, have added second row table , price changes in first row, not second. i appreciate guys can give. javascript: <script type="text/javascript"> function currencycheck() { var option = document.getelementbyid("currency-select").value; if (option == "euro") { document.getelementbyid("eur").style.display =""; document.getelementbyid("gbp").style.display ="none"; document.getelementbyid("dkk").style.display ="none"; } if (option == "gbpound") { document.getelementbyid("gbp").style.display =""; docum

Defining multiple functions in Python -

i'm new writing code, , i'm working through "learn python hard way." want define both personname , hoarder following result: fred had 45 cats. bill had 20 dogs. lot of animals. find therapist! def personname(name1, name2): def hoarder(number_of_cats, number_of_dogs): print "%r had %d cats." % (name1, number_of_cats) print "%r had %d dogs." % (name2, number_of_dogs) print "that lot of animals." print "find therapist!" print person("fred", "bill") hoarder(45,20) def personname(name1, name2): def hoarder(number_of_cats, number_of_dogs): print "%r had %d cats." % (name1, number_of_cats) print "%r had %d dogs." % (name2, number_of_dogs) print "that lot of animals." print "find therapist!" hoarder(45,20) personname("fred", "bill") 'fred' had 45 cats. 'bill' had

sql server 2008 - How to Restore SQL Backup within Visual Studio -

got sql backup file of database generated via visual studio's>server explorer>"publish provider" but cannot restore sql backup in visual studio's query window raises error: window title:"query definitions differ" error text:"drop table sql construct or statement not supported" so how can execute sql database backup file ?(generated using vs>"publish provider") thanks.

android - Having trouble implementing two-way-gridview -

i think it's adapter problem lies, worked on normal gridview, assumed able switch two-way-gridview in place of gridview. 1 place used nothing shown , other place images don't fill view vertically , there more columns have set. here's adapter code: public final class covergridviewadapter extends baseadapter { private final context context; private final list<string> urls = new arraylist<string>(); private final arraylist<hashmap<string,string>> arraylist; public covergridviewadapter(context context, arraylist<hashmap<string, string>> arraylist) { this.context = context; this.arraylist = arraylist; } @override public view getview(int position, view convertview, viewgroup parent) { // image url current position. //string url = getitem(position); final hashmap<string,string> game = getitem(position); coverimageview view = (coverimageview) convertview; if (view == null) { view =

Why does node.js, http-server, show that there are two request coming? -

i have following simple http-server setup using node.js: var http = require('http'); var port = 12311 http.createserver(function (req, res) { console.log("incomming request " + req.connection.remoteaddress); res.writehead(200, { 'content-type': 'text/plain' }); res.end("test string"); }).listen(port); console.log("listening on " + port); as can see, when request comes in, log console. when browse localhost:12311 console shows 2 connections have come in: "e:\program files\nodejs\node.exe" hello-world-server.js listening on 12311 incomming request 127.0.0.1 incomming request 127.0.0.1 why this? it's request favicon.ico . if don't have one, it's requested norm defines default file path if don't set relevant <link rel="shortcut icon"... in header. the best ways find requests : client side, opening developer tools , looking @ network tab. server side,

image - Crop thumbnail in imagemagick - specify center at X, Y position -

i generate thumbnails website. using following process folder (based on this answer): mogrify -interlace plane -thumbnail 280x210^ -gravity center -extent 280x210 -quality 85% *.jpg this create thumbnails given size (resize , crop). i have single image version of command: convert test.jpg -interlace plane -thumbnail 280x210^ -gravity center -extent 280x210 -quality 85% testout.jpg i'm using facedetect positions of faces original image (before creating thumbnails). photos faces have calculated average x, y position of faces center. now, use position in command above crop pictures smarter. image cropped both sides ( -gravity center ), use coordinates faces displayed when image cropped. is there way how can feed imagemagick? you use -shave remove part of image, face moves center, apply original command.

php - one to many relationship help in laravel 4 -

i trying create relationship between category , product somehow couldn't use category connect product table , prints out product names , instead category's name in database table name: products columns: id, name, price, category_id, description table name: categories columns: id, name, description in products table id: 1 name: product1 price: 10 category_id: 1 description: p1 --------------- id: 2 name: product2 price: 10 category_id: 1 description: p2 in categories table id: 1 name: category1 description: c1 --------------- id: 2 name: category2 description: c2 product.php inside models folder class product extends eloquent { protected $product = 'products'; public function category() { return $this->belongsto('category'); } } category.php inside models folder class category extends eloquent { protected $category = 'categories'; public function product() { return $this->hasmany(&#

windows - CRC Reverse Engineer (Checksum from Machine / PC) -

i'm looking on how determine crc produced machine pc (and vice-versa). devices communicating using serial communication or rs232 cable. i have data able create program used both devices. data given boss , program corrupted. trying work out. hope can help. :) the sequence use crc calculation in protocol ascii string starting first printing character (e.g. 'r' req) until , including '1e' in calculation. it's crc following specs according our crc calculator crc:16,1021,0000,0000,no,no which means: crc width: 16 bit (of course) polynomial: 1021 hex (truncated crc polynomial) init value: 0000 final xor applied: 0000 reflectedinput: no reflectedoutput: no` (if 'init value' ffff, "16 bit width crc designated ccitt"). see docklight crc glossary , boost crc library on crc terms mean plus sample code. what did write small script tries out popular 16 bit crcs on varying parts of first simple "req=ini" c

How can I make a string of objects names in java -

i write function enable me following inputs: variable number of objects of type output: string nameobj1=valueobj1, ..., nameobjn=valueobjn all objects pass function have tostring() method. example: double x=1.1; int y=2; classa thefunction(x,y,a) => output "x=1.1, y=1, a=[whatever a.tostring() output]" is possible ? here's close: you can write var-arg function so: public static string describearguments (object... arguments) { stringbuilder output = new stringbuilder(); int counter = 1; (object argument : arguments) { output.append("object #").append(counter++).append(": ").append(argument.tostring()); } return output.tostring(); } strictly speaking method arguments dont have names. retrieve argument parameter name using reflection if symbol tables werent stripped out @compile time, brutish , ugly.

c# - Unable to pass model from View to controler using ajax -

first of can search , found questions this: ( passing model view controller using jquery ajax but when i'm trying make in marker answer receive error circular reference i'm asking in sending model view controler: here view: @model magazyn.models.deviceusage @{ viewbag.title = "return"; //layout = "~/views/shared/_layout.cshtml"; var val = json.encode(model); } <h2>return</h2> <script> $(document).ready(function () { $('.z').on('click', function (event) { event.preventdefault(); var check=@html.raw(model) $.ajax({ url: "/deviceusage/return", type: "post", contenttype: "application/json; charset=utf-8", datatype: 'html', data: '{dev:' + json.stringify(check) + '}', error: function (data) {

javascript - Display an alert box in php and navigate back -

i want display javascript alert box in php , navigate main page. here code session_start(); $name= $_session['name']; $id= $_session['id']; //check if guest if($name=="guest"){ echo'<script type="text/javascript">alert(" not allowed view contnent"); </script>'; header('location: mainpage.php'); } //the rest of page with code alert popup not displayed redirection. try this $name= $_session['name']; $id= $_session['id']; //check if guest if($name=="guest"){ echo'<script type="text/javascript">window.alert(" not allowed view contnent");</script>'; echo'<script type="text/javascript> window.navigate("mainpage.php"); </script>'; } //the rest of page now popup displayed redirection not work.

css - Responsive Web Design float position -

Image
i trying achieve following in 2 column float css design my css 2 this: .div1 { width: 25%; float:left; } .div2 { width: 75%; float: right; } .container { width:960px; } @media screen , (max-width: 320px) { .div1, .div2 { width: 100%; display: block; float: none; clear: both; } .container { width: 100%; } } my html this: ... <div class="container"> <div class="div1"> ... content inside </div> <div class="div2"> <img src="photo_loc"/> </div> </div> i have div , div ii. div 25% width , div ii 75% width. when go 320px (iphone portrait) using responsive design div ii goes below div i, assume normal process. what trying have div ii above div using floats, how can achieved through css? swap html positions of div1 , div2 around. it may not semantically correct in terms of how page should layed out still work. keep css same , have html this <div class=&

php - How to set persistent connect with Facebook -

i have, on website, login facebook (api php). when user, click on "connect facebook" (and it's ok), give him session log in him on website ... but, if user close browser, session destroy ... so, question is, how do, persistent connection ... here code: if(!$member->isloggedin()){ //set facebook $fb_s = zend_registry::get('config'); $config = array( 'appid' => $fb_s->facebook->appid, 'secret' => $fb_s->facebook->secret ); $facebook = new facebook($config); $user = $facebook->getuser(); //not logged in on website, logged in on fb if($request->getcontrollername() != "login"){ =========> $user empty .... if($user){ try{ $user_profile = $facebook->api('/me'); $membres = new membre(); if(!$membre = $membres->getmemberbyfb($user_profile['id'])){ // need re logged in";

How to realize the "undo" functionality in CQ5 Rich Text Editor with a button? -

Image
using cq rich text editor , can undo editing strg + z . how connect functionality button? in other words find javascript responsible undo functionality? in rte plugins (in xml file), use: <table jcr:primarytype="nt:unstructured" features="*"/> <undo jcr:primarytype="nt:unstructured" features="*"/> hope solves problem. for more info check here

jsf 2 - <h:commandButton> not working inside <ui:define> -

i created facelet template called loginregistertemplate.xhtml. when use in template client , place in it, method in managed bean not invoked. without template button working fine. why happening? <ui:composition template="resources/css/faceletstemplates/loginregistertemplate.xhtml"> <ui:define name="top"> login page </ui:define> <ui:define name="content"> <div align="center"> <h:panelgrid columns="3" columnclasses="rightalign,leftalign,leftalign"> <h:outputlabel value="username:" for="username"/> <h:inputtext id="username" label="username" required="true" value="#{loginbean.username}" /> <h:message for="username" /> <h:outputlabel value="passwo

asp.net mvc - How to bind value from database to Dropdown List in MVC 3 -

i trying bind dropdown list database in mvc3. i have 2 tables. tblemp: empid (pk), ename, age, address, emailid, deptid (fk). tbldept deptid (pk), deptname, depthead. i trying bind create employee application basic details of employee name, age, address, emailid, , dept name. trying bind dept name dropdownlist other table. this model: namespace mvcemployeeapplication.models { public class uandpcompare { public int empid { get; set; } public string ename { get; set; } public int age { get; set; } public string address { get; set; } public string emailid { get; set; } public int deptid { get; set; } public string deptname { get; set; } public string depthead { get; set; } public ilist<selectlistitem> drp_deptnames { get; set; } } } this controller: [httpget] public actionresult create() { filldeptname(); return view(); } [httppost] public actionresult create(tblemployee tbl

matlab - Principal Component Analysis? -

i strugling pca stuff. so example have : data=100*3 substractdata=data-mean (the size same 100*3) covariance=3*3 eigenvector=3*3 eigenvalue=3*3 and reduction our data, have eliminate number of eigen value , eigen vector based on k for example k=2 so number of eigenvalue become 2*2 eigenvector = 2*2 1st ques: right? and have project out matrix project=eigenvector (which 2*2) *substractdata (100*3) 2nd ques: how can calculate this, because size of eigenvalue , substractdata different? and question, 3rd ques: if want use reduction data should use project? 4th ques: if want show principal components (which first , second columns of eigen vector), have plot principal components along data (initial data) or substractdata? your eigenvalue 3*3 matrix diagonal matrix. eigenvalues scalars along diagonal. reduce dimensionality pick k=2 eigenvectors correspond 2 largest eigenvalues. need sort eigenvectors based on corresponding eigenvalues , pick 2 hav

performance - Different Ways of Date Comparision in MySQL -

in mysql there multiple ways, compare dates (date , datetime fields). i'm asking me whether there advantages or disadvantages (performance, query parser, human-readability, ...) on different options). here variants, know (i think there more...): select my_date = 20140101 select my_date = "2014-01-01" select date(my_datetime) = 20140101 select year(my_datetime) = 2014 , month(my_datetime) = 1 , day(my_datetime) = 1 select my_datetime between "2014-01-01" , "2014-01-01 23:59:59" are there more possibilities? i think, comparision using date-functions (date, year, month, day) ineffective query optimizer can not use index. from pure technical point of view yes, of variants make use of function evaluation slower other solutions. (although might sped optimizer, mysql not count on that.) i not expect performance difference between first , second variant. 1 distinguish between datetime , timestamp type of column. timestamp stored

data mining - WEKA- ReliefF algorithm -

i ask if relieff algorithm attribute selection, implemented in weka toolkit, performs normalization in attributes before ranking them. thank yes, internally relieff algorithm min-max normalisation numeric attributes. can check source code of weka.attributeselection.relieffattributeeval class confirm same.

java - Is there an alternative to CopyOnWriteArrayList which can be sorted? -

i have collection of 'effects' draw on 'object' in gui ( gradients, textures, text etc ). nature of underlying system means effect collection can accessed multiple threads. majority of operations reads, @ moment i'm using copyonwritearraylist works ok. but need sort collection of effects based on draw order whenever add new effect or change effect's draw order. need able iterate through collection in forwards & reverse ( iterater.next() & iterator.previous() ). after research i've found copyonwritearraylists don't being sorted: behaviour of copyonwritearraylist if tried sort copyonwritearraylist you'll see list throws usupportedoperationexception (the sort invokes set on collection n times). should use read when doing upwards of 90+% reads. i found suggestion of using concurrentskiplistset, handles concurrency & sorting, looking @ javadoc i'm worried this: beware that, unlike in collections, size method not cons

osx - Use of undeclared identifier Objective-C Code -

i new objective-c coding ,please bear me ask if simple question my header file: #import <cocoa/cocoa.h> @interface appdelegate : nsobject <nsapplicationdelegate> @property (assign) iboutlet nswindow *window; @end my implementation file: #import "appdelegate.h" @implementation appdelegate - (void)applicationdidfinishlaunching:(nsnotification *)anotification { // insert code here initialize application // listing 2-1 creating connection using nsurlconnection // create request. nsurlrequest *therequest=[nsurlrequest requestwithurl:[nsurl urlwithstring:@"http://www.apple.com/"] cachepolicy:nsurlrequestuseprotocolcachepolicy timeoutinterval:60.0]; // create nsmutabledata hold received data. // receiveddata instance variable declared elsewhere. receiveddata = [nsmutabledata datawithcapacity: 0]; // create connection r

javascript - Extjs confirm box callback handling -

in extjs code checking value of warning flag. if flag set want show confirm (okcancel) box user ask user if wants proceed though there warning. now confirm box if user clicks ok, code should proceed next command in sequence , if clicks cancel code should return. following code: if(warning){ ext.messagebox.show({ title: 'icon support', msg: 'are sure want proceed?', buttons: ext.messagebox.okcancel, icon: ext.messagebox.warning, fn: function(btn){ if(btn == 'ok'){ // go alert statement below. } else { return; } } ); alert('wants proceed ahead'); //if user clicks ok come here } now problem facing when code enters if block shows message box , alerts wants proceed ahead . i can stop happening putting return; statement before alert() . but how go alert statement after user clicks ok button? callbacks event

javascript - Angular JS - How to filter a list using multiple links -

i have problem using filter function in angular js. have filter list using different links. can't understand how filter list. tried examples doesn't work. how can it?? code now: html <tr ng-repeat="rubric in examplerevisions | filter:myfilter" class="{{rubric.translationproposal.validations[0].class}}"> <td></td> <td>{{rubric.translationproposal.validations[0].createdby}}</td> <td>{{rubric.translationproposal.validations[0].createdon | date:'dd/mm/yyyy'}}</td> <td>{{rubric.translationproposal.validations[0].action}}</td> <td>{{rubric.action}}</td> </tr> <a href="" ng-click="myfilter = {action: 1}">ok</a> <a href="" ng-click="myfilter = {action: 2}">new proposal</a> <a href="" ng-click="myfilter = {action: 3}">null</a> js $scope.examplerevisions contains

Can I install created Java program on My PC? -

i want use calculator app created in java on pc how can use class file install calculator app on pc? you can create runable-jar-file: more runable jar file or create bat-file: more file

Using C# to duplicated PHP serialized data in MySQL -

Image
i'm trying use c# duplicate php serialize functionality, can save data correctly in mysql database. the data save php serialized data, except unknown characters. for example, data saved php looks "a:5:{s:12:"post_name"..." in sqlyog. but when copy text editor, looks a:5:{s:12:"?post_name"...". anyone have idea "?" character is? thanks! c# php mysql serialization share | improve question asked mar 6 '14 @ 11:24 louisa 298 6 16