Posts

Showing posts from March, 2013

javascript - jQuery UI autocomplete drop down not displaying -

Image
i trying use jquery ui autocomplete feature search spotify's music library. while passes well, , successful response: there no drop down suggestions. instance searching "time" , wanted see: time hans zimmer <--(this searching for) back in time pitbull elevate big time rush etc. here javascript code: <script>$(function() {$( "#spotify_song_search" ).autocomplete({source: function(request, response) { $.get("http://ws.spotify.com/search/1/track.json", { q: request.term },function( data ) { alert(data); response(data);}); },success: function(data) { // pass data response callback alert(data); response(data); }});});</script> i must doing wrong. checked jquery docs here: http://jqueryui.com/demos/autocomplete/ doesn't give explanation why occur. , added alerts see if @ least response, do, returns [object object] . need display search results? error: uncaught...

How to call a self executing function in JavaScript? -

when have code need execute more once wrap in function don't have repeat myself. in addition there's need execute code on page load. right way: function foo() { alert('hello'); } foo(); i rather way: (function foo() { alert('hello'); })(); problem is, execute on page load if try call subsequent times using foo() won't work. i'm guessing scope issue there way self executing functions work upon getting called later? if function doesn't rely on return value, can this... var foo = (function bar() { alert('hello'); return bar; })(); // hello foo(); // hello this uses local reference bar in named function expression return function outer foo variable. or if does, make return value conditional... var foo = (function bar() { alert('hello'); return foo ? "some other value" : bar; })(); // hello alert( foo() ); // hello --- other value or manually assign variable instea...

gwt - In PlayN, how can I build the HTML version of my project from the command line? -

currently i'm building in eclipse using gwt plugin. i'd automate deployment development webserver using script gwt compilation command line. i've followed directions in running via maven section of getting started page : mvn -phtml integration-test but tries build versions, erring out on android build (which i'd prefer skip @ moment) , throws warning stating html profile doesn't exist: [info] ------------------------------------------------------------------------ [info] reactor summary: [info] [info] myplayngame metaproject .......................... success [0.375s] [info] myplayngame core ................................. success [1.638s] [info] myplayngame java ................................. success [0.319s] [info] myplayngame html ................................. success [4.019s] [info] myplayngame android .............................. failure [0.308s] [info] ------------------------------------------------------------------------ [info] build...

javascript - want to append URL as well as want to submit the form with Get request of HTML -

in jsp page have 1 tag .the url of tag setting in java script calls servlet.so parameters passing request. the above wroks fine generates pdf of current form data in url user can see parameters. now problem have added 1 more parameter sending servlet request quite long.so gives error."too long uri request".the data seding javascript variable. i can not change post want data passed in url.and parameter adding(the large one) can hidden variable or so..??? so can suggest should do?? <div class="pdflink"> <a id="pdflinkforgroup" href="" onclick="getpdf('<%=reportid%>','',reporttitle)"> <img src="/images/pdficon.jpg" class="pdflink"></img></a></div> getpdffunction: atag=document.getelementbyid("pdflinkforsingle"); var querystring = "?"+qry+qstring+"&offset=" + offset + "&limit=1000"+"&img...

wpf - Why is animation starting on mouse down? -

i have stackpanel consists of images: <stackpanel height="115" name="stackpanel1" orientation="horizontal" margin="0"> <!-- *******************stackpanel resources****************************--> <stackpanel.resources> <style targettype="{x:type image}"> <style.resources> <storyboard x:key="storyboard1"> <doubleanimationusingkeyframes storyboard.targetproperty="(frameworkelement.width)"> <easingdoublekeyframe keytime="0:0:0.9" value="100"> <easingdoublekeyframe.easingfunction> <backease easingmode="easeout" /> </easingdoublekeyframe.easingfunction> </easingdoublekeyframe> ...

c - Algorithm to find shortest distance from a point in set A to points in set B -

there set n 3d points (x,y,z) , set b m 3d points (x,y,z). each point (xi,yi,zi) in set have find point in set b has minimum distance (xi,yi,zi). my code running out of given time limit. please help. #include<stdio.h> #include<stdlib.h> #include<math.h> long long np[50000][3],qp[50000][3]; int main() { long long n,q,i,j,d,ans,min; scanf("%lld",&n); for(i=0;i<n;i++) scanf("%lld%lld%lld",&np[i][0],&np[i][0],&np[i][2]); scanf("%lld",&q); for(i=0;i<q;i++) scanf("%lld%lld%lld",&qp[i][0],&qp[i][1],&qp[i][2]); for(i=0;i<q;i++) { ans=0; min=((qp[i][0]-np[0][0])*(qp[i][0]-np[0][0]))+((qp[i][1]-np[0][1])*(qp[i][1]-qp[0][1]))+((qp[i][2]-np[0][2])*(qp[i][2]-np[0][2])); for(j=0;j<n;j++) { d=((qp[i][0]-np[j][0])*(qp[i][0]-np[j][0]))+((qp[i][1]-np[j][1])*(qp[i][1]-qp[j][1]))+((qp[i][2]-np[j][2])*(qp[i][2]-np[j][2])); if(d<min) { ans=j...

wsdl - ServiceMix + broadcasting message -

new servicemix, i'm not sure if can need: i've interface defined wsdl i have several endpoints implement interface defined wsdl i've service can send message 1 endpoint. can service mix following: producer sends endpoint in servicemix (with wsdl). servicemix broadcasts different endpoints message. thanks advice , / or pointers! the simplest use camel recipient list . allow have either static or dynamic destinations broadcast. it sounds if application doesn't require termination of soap message (de/serialize payload to/from object) @ servicemix consumer. therefore can kept simple using camel jetty proxy: there further details on link above on how configure static (the example above) , dynamic routing. if application changes , require termination of soap message @ servicemix consumer in future, change out camel jetty consumer endpoint camel cxf endpoint , se...

asp.net mvc - Unsure about parameter -

i working on beginner's mvc tutorial. wondering if explain how or parameters of method chosen? public actionresult details(int id) { var album = storedb.albums.find(id); return view(album); } there 2 ways id parameter populated: http://www.example.com/{controller}/details/{id} or http://www.example.com/{controller}/details?id={id} where {controller} name of controller, eg. name of homecontroller.cs "home" , {id} int.

open ticket based on user credit in whmcs -

i want give default 50 credits users , when open ticket (subtract 5 credit) , if them subtract more credits user . , when credit finishes have buy credit have more support. there such addon whmcs or similar support script ? don't want customers abusing support offer them , tend abuse , expect them free because i'm offering support . possible whmcs or other script? i doubt can done standard whmcs ways. idea of whmcs selling products have either recurring (monthly, quarterly, etc.) or one-time payments. product want sale (support access) not above: requeres client charged on event (submit ticket).

javascript - A good port for my nodejs game? -

i making nodejs game. have tried many ports(25565,12100,2754,6112,1337 , other random ports). of them worked serverside, clientside blocked firewalls or (what biggest concern) used else increased latency alot. need port is(if possible) open , got nothing using disturb game's connection. suggestions ports? you should checkout study websockets , firewalls made guys @ socket.io: https://github.com/learnboost/socket.io/wiki/socket.io-and-firewall-software

c# - Getting relative root in Global.Asax -

i trying store physical root , relative root of application in memory @ application startup. i did physical path so: //get physical root , store global.applicationphysicalpath = request.physicalapplicationpath; but cannot relative path. have following code works, requires put in page object: global.applicationrelativepath = request.url.absoluteuri.replace(request.url.absolutepath, "") + page.resolveurl("~/"); thanks in order relative path within application_start use following: protected void application_start(object sender, eventargs e) { string path = server.mappath("/"); }

oop - Why I should go for Interfaces in C# when I can implement the methods directly -

i aware basic question, interviewer asked me in trick way , helpless :( i know material or theoretical definition interface , implemented in many projects worked on. don't understand why , how useful. i don't understand 1 thing in interface. i.e example, use conn.dispose(); in block. don't see class implementing or inheriting idisposable interface ( sqlconnection ) class mean. wondering how can call method name. in same thing, not understanding how dispose method works because, need implement function body our own implementation interface methods. how interfaces accepted or named contracts? these questions kept on rolling in mind till , frankly never saw thread explain questions in way can understand. msdn usual looks scary , no single line clear there ( folks, kindly excuse high level development, feel code or article should reach mind of see it, hence many others say, msdn not of use ). the interviewer said: he has 5 methods , happy implement in class di...

MySQL count users in common between pairs of posts through many to many relationship -

i have mysql database 3 tables: users, posts, , users_posts. users-posts relationship many-to-many. how can list of pairs of posts , how many users have in common? gives me list of posts , how many users have commented on both. point have data ready import network analysis software. resulting list called "edgelist" in network terms, users in common edge weight. schema: users id name posts id title body users_posts user_id post_id desired output: postname1 postname2 users_in_common here's title title #2 2 post title #2 11 i tried searching didn't know right search terms among many-to-many, join, 3 tables, count, pairs, shared, etc. help! my query produces pairs of posts including without common users (will have 0 in users_in_common in such case). try solution on sql fiddle or see code: select p1.title postname1, p2.title postname2, coalesce(s.users_in_common, 0) users_in_common posts p1 inner j...

How to call function with callbacks in Java like I do it in C#? -

i'm pretty new java need write c# code (this hand-typed prototype illustrate need) private void parentfunc() { var worker = new workerclass() worker.dowork(e => console.write("progress" + e)); } public class workerclass() { public method dowork(action<int> callback) { (int i=1; i<1000; i++) callback.invoke(i); } } little explanation. i'm using asynctask in android , calling outside processor classed them signal can publishprogress . prefer not put interface on asynctask since closures not supported yet have use interface , anonymous inner class. private void parentfunc { workerclass worker = new workerclass(); worker.dowork(new callback<integer>() { public void invoke(integer arg) { system.out.println("progress" + arg); } }); } public class workerclass { public dowork(callback<integer> callback) { (int i=1; i<1000; i++) callb...

In PowerShell, how can I test if a variable holds a numeric value? -

in powershell, how can test if variable holds numeric value? currently, i'm trying this, seems return false . add-type -language csharpversion3 @' public class helpers { public static bool isnumeric(object o) { return o byte || o short || o int || o long || o sbyte || o ushort || o uint || o ulong || o float || o double || o decimal ; } } '@ filter isnumeric($inputobject) { [helpers]::isnumeric($inputobject) } ps> 1 | isnumeric false modify filter this: filter isnumeric { [helpers]::isnumeric($_) } function uses $input variable contain pipeline information whereas filter uses special variable $_ contains current pipeline object. edit: for powershell syntax way can use filter (w/o add-type): filter isnumeric() { return $_ -is [byte] -or $_ -is [int16] -or $_ -is [int32] -or $_ -is [int64] ` -or $_ -is [sbyte] -or $_ -is [uint16] -o...

ColdFusion oAuth RSA-SHA1 authorisation for Xero wrapper -

Image
i'm writing wrapper xero api, using oauth , two-legged authentication. "private" application, xero calls it, requires rsa-sha1 signature. coldfusion oauth wrapper doesn't have function encrypting in rsa-sha1, hmac-sha1. on cf9. consequently, in course of running request, following error: signature_method_rejected private applications must use rsa-sha1 signature method so, looks call working, issue signature method. found thought looked solution created, follows: <cffunction name="rsa_sha1" returntype="string" access="public" descrition="rsa-sha1 computation based on supplied private key , supplied base signature string."> <cfargument name="signkey" type="string" required="true" hint="base64 formatted pkcs8 private key"> <cfargument name="signmessage" type="string" required="true" hint="msg sign...

Element Name Attribute in WPF Databinding -

what use of element name attribute in wpf databinding. e.g. <window x:class="wpfapplication1.window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="window1" height="300" width="300" name="win"> <textbox x:name="txtdata" width="100" height="26" text={binding elementname=win,mode=twoway,path=data}/> <window> regards, priyank thakkar it's binding element in application - see http://msdn.microsoft.com/en-us/library/system.windows.data.binding.elementname.aspx in case attempting bind window element name win .

extjs4 - ExtJS 4 prbolem with using business logic in the controller when it's triggerd from the view -

i have view designed that: ext.define('my.view.notificationmails', { extend: 'ext.grid.panel', alias: 'widget.notificationmailspanel', id: 'id-notification-mails-panel', and have controller view is: ext.define('my.controller.notificationmailscontroller', { extend: 'ext.app.controller', models: [ 'notificationmailsrecord' ], stores: [ 'notificationmailsstore' ], views: [ 'notificationmails' ], // refs:[{ // ref: 'notificationmails', // selector: 'mailgrid' // }], init: function() { this.control({ '#id-notification-mails-panel': { itemclick: this.clickedsomething } }) }, and make test , find problem simple function definition itemclick : clickedsomething: function() { console.log('deteceted click'); } but nothing happens. trie...

SQL Query to retrieve rows having conditional values in a column -

i don't know if question has been asked also. if please direct me link. i have table has 3 columns name , type , date . type can 4 values a, b, c , d i want fetch records of type a, b or c condition should fetch if same name has type of d. e.g. lets consider table name type date abc 5/7 abc b 6/7 abc d 7/7 xyz 5/7 xyz d 6/7 lmn 5/7 lmn b 6/7 lmn c 7/7 so deal here need following result set abc 5/7 abc 6/7 xyz 5/7 because abc , xyz has type d other records of abc , xyz shown. since lmn not have type d it's not included in result set. to test if record exist, can use where exists : select * mytable t1 exists ( select * mytable t2 t1.name=t2.name , t2.type="d" ); that's self explanatory here's reference : http://dev.mysql.com/doc/refman/5.0/en/exists-and-not-exists-subqueries.html if want exclude d records, ...

java - How to determine the Method invoked by an InvokeInstruction (BCEL)? -

i trying determine methodgen of callee given invokeinstruction in bcel library. problem don't know how use invokeinstruction methodgen trying invoke. if have bcel methodgen object main method of program, can go through list of instructions , find ones invokeinstructions: // assume methodgen mainmg given instruction[] insns = mainmg.getinstructionlist().getinstructions(); for(instruction insn : insns) { if(insn instanceof invokeinstruction) { // great, found invoke instruction invokeinstruction invoke = (invokeinstruction)insn; // do now? } } some of bcel's documentation great , other parts kind of lacking. suggestions how link invokeinstruction methodgen of method being invoked? if simplifies things, can assume program doesn't have polymorphism. though @ point have deal (conservatively). clarification : realize there isn't direct route doing (e.g. invoke.getcalledmethodgen() ), wondering if there way can enough distinct in...

php - pass variables through imagemap -

i have country map many cities. have spotted every city imagemap. display database data relevant each city when spot clicked. there possible way pass variables(id?) through imagemap in order display data using variable? thanks lot! you can use query part of url in href attribute of area element (i presume using so-called client-side image map, using map element containing area elements). example: <area shape="circle" coords="100,200,5" alt="london" href= "/foo.php?thing=42&amp;stuff=something&amp;country=gb">

How to have both a default value and a set value in codeigniter forms? -

i have form in codeigniter , have default value input set_value(). this input: echo form_input('job_position',set_value('job_position')); i have set value in place , working how can add default value of '12'? you can set default if value empty. from codeigniter site : set_value() permits set value of input form or textarea. must supply field name via first parameter of function. second (optional) parameter allows set default value form. example: <input type="text" name="job_position" value="<?php echo set_value('job_position', '12'); ?>" size="50" /> the above form show "12" when loaded first time.

regex - Searching for partial matches an array using .grep and RegExp - Jquery -

im new-ish jquery , im stuck. i've build function search array , return matched word , definition(from array same index) , works fine. now trying search partial matches. ive searched on stackoverflow , rest of internet try , figure out how work , why not working, im stuck. heres code $("#search").submit(function() { = $("#term").val(); if ($.inarray(a,glossary) > -1) { loc = $.inarray(a,glossary); $("#pterm").text(glossary[loc]); $("#definition").text(def[loc]); return false; }else if ($.grep(glossary, function(value) { var search = new regexp(a,"gi"); if (value.match(search))return true; return false;}) == true) { $("#pterm").text(" "); $("#definition").text("partial match found."); return false; }else { $("#pterm").text(" "); $("#defi...

mongodb - Remove embedded document in a nested array of documents -

my schema looks this: "content" : [ { "_id" : objectid("4fc63de85b20fb72290000f8"), "assets" : [ { "path" : "temp/4f840af9565832fa14000002/4f840b1e565832fa14000007/4fc63de85b20fb72290000f7/content/i_understanding_and_measuring.pdf", "_id" : objectid("4fc63def5b20fb722900010e") }, { "path" : "temp/4f840af9565832fa14000002/4f840b1e565832fa14000007/4fc63de85b20fb72290000f7/content/me.jpg", "_id" : objectid("4fc63e4d5b20fb722900015d") } ], "content" : "", "name" : "downloads" }, { "_id" : objectid("4fc63dfd5b20fb722900012a"), "assets" : [ ...

xml - Why is MemoryStream limited to 6KB of data? -

i have xml document, 7,917 characters. it's read xelement using linq xml, need map/convert/adapt xelement string (to send web service). here method: public string adaptxelementtostring(xelement xml) { encoding encoding = encoding.getencoding(specializedencodings.iso88591); using (memorystream memorystream = new memorystream()) { xmlwritersettings settings = new xmlwritersettings { encoding = encoding }; memorystream.setlength(21*1024*1024); using (xmlwriter writer = xmlwriter.create(memorystream, settings)) { xml.writeto(writer); memorystream.flush(); string xmltext = encoding.getstring(memorystream.toarray()); return xmltext; } } } when call method, can see using intellisense 'xml' has entire contents of file. however, string xmltext gets chopped off @ 6144th character (which 6 kb exactly). be...

.net - Logging into a website via C#, navigating to another web page, and then output the source code as a string -

i relatively new working web pages in c#. trying log particular website ( https://www15.swalife.com/portalweb/portal/cwalogon.jsp ) , allowing page redirected default page, , navigating there (https://www15.swalife.com/csswa/ea/plt/accesselitt.do) , downloading source code , output string. i have figured out how download source code via httpwebrequest , httpwebresponse having trouble on coding logging in function. assume have post? have looked @ http://www.dreamincode.net/forums/topic/152297-c%23-log-in-to-website-programmatically/ also. thanks in advance!! edit: the code supplied jimmyjambles works flawlessly, except doesn't quite me source code of page wanted. code suggests log-in process failed, believe little bit of tweaking work...also having issues with: servicepointmanager.servercertificatevalidationcallback = new remotecertificatevalidationcallback(acceptallcertifications); try changing "public string" , "public bool" functions "p...

coding SVG inline in an ASP.NET page causes the SVG javascript createSVGPoint(); function to break -

i require asp.net server side code in svg created. accomplish this, created .aspx file , inserted svg code this: <%@ page language="c#" autoeventwireup="true" codebehind="mypage.aspx.cs" inherits="myapp.mypage" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="700px" height="700px" onload="initialize()"> <script type="text/ecmascript"> <![cdata[ script here <% server code %> ]]> </script> <defs> <style type="text/css"> <![cdata[ svg styles ]]> </style> </defs> svg code <% server code %> </svg> this works fine, can use <% %> , add server side ...

php - create another multi dimensional array from an array -

suppose have array $x= ('a'=>31, 'b'=>12, 'c'=>13, 'd'=>25, 'e'=>18, 'f'=>10); i need generate array this $newx = (0 => array('a'=>31 , 'b' =>1) , 1 => array('b'=>11 , 'c' =>13 , 'd'=>8) , 2 =>array('d'=>17 , 'e'=>15) , 3=>array('e'=>3,'f'=>10); now in case each value of $newx has = 32 , how work $x[a] = 31 , $x[b] = 12 first of have make sum quantity 32 keeping index same new array i.e array(0=>array('a'=>31,'b'=>1) , 1=>array('b'=>11) ) the process should continue each value of $x. while i'm pretty sure homework assignment , well, should provide code of own, @ least try to, found thing amusing went ahead , gave try. guess i'll downvoted , deserve it, here goes anyway. what need is: loop through array, determine elements give 32 , ...

build.xml - Conditional concatenation in Ant -

i have task like: <target name="sometarget"> <concat destfile="somefile"> <string>somestring</string> <string>someotherstring</string> </concat> </target> <target name="someothertarget"> <antcall target="sometarget"> <param name="myparam" value="myvalue"></param> </antcall> <antcall target="sometarget"> </antcall> </target> how can concatenate someotherstring if myparam supplied when calling sometarget target? without ant extensions, use conditional ant execution : <project default="someothertarget"> <target name="sometarget" depends="-somestring,-someotherstring"/> <target name="-somestring" unless="myparam"> <concat destfile="somefile"> ...

Android - UnsatisfiedLinkError: setAndroidSdkVersion -

Image
i have modified linphone-android source codes own app. works fine on android version 2.3.3 2.3.6, when tried running on android 4.0.3 (galaxy s ii), returns me error: "unsatisfiedlinkerror: setandroidsdkversion", not have idea about. hope can me. thanks! here have gotten logcat.

extjs - use sencha touch 2 to connect facebook -

possible duplicate: using oauth in sencha touch 2 connect facebook i want sencha touch 2 mobile app connect facebook. possible using sencha ? believe oauth 2.0 required authenication. can done ext js? i've looked around , found oauth v1 libraries javascript , jquery mobile only. also, there apis working facebook works sencha touch 2? thanks you should able use facebook javascript sdk sencha without trouble. facebook's js sdk loads asynchronously, , provides own load event when sdk ready use. you can implement client-side authentication without relying on sencha, or triggered via interaction sencha ui components. see https://developers.facebook.com/docs/authentication/client-side/ client-side authentication flow, , http://www.sencha.com/products/touch/demos/ example of in action (jog friends).

c# - How do I localize data annotations messages in MVC3? -

possible duplicate: localization of displaynameattribute [serializable] public class foo { [displayname("??")] [required] public string name { get; set; } } what best solution localising property? you have use globalresources, check example below resource1.resx |name|name| |....|....| |....|....| resource1.da.dk |name|navn| |....|....| |....|....| [required(errormessageresourcetype = typeof(resources.resource1), errormessageresourcename = "name")] public virtual string name { get; set; }

matlab - thresholding an image based on gradient -

i have multiple simple circle objects in grid of image want create mask image objects. gotcha light intensity each object different. simple thresholding not create mask. as solution, want threshold based on gradient. basically, i'd first find circle edge detection , make inside of circle white , outside black. slow. there better way on matlab? i create low-pass filtered version of image, , use threshold. "strength" of filter should tuned in order make result follow distribution of light intensity, not hard. (this approach worked me when had extract contour of blood vessels brain-surface images, few years ago.)

What Goes in the Controller for an AJAX get request in GRAILS -

i have ajax call in view, var ajaxdata= $.ajax({ type: "get", url: "${createlink(controller:'profile',action:'ajaxlist')}", success: function(data) { } }); i created method in profilecontroller.groovy class in order return "data" call, don' know how format controller correctly. here want return. model, profile, has name , description. want return hash object key name , value description. there way in controller ajax call returns hash. aprpeciated. thanks! in controller's ajaxlist action build model want it, usual, , instead of return model @ end want render model json . for example, class profilecontroller { def ajaxlist() { def profiles = profile.list() def model = profiles.collect { [(it.name): it.description] } render model json } } and if want use same list action returning different formats, @ using withformat .

css - Equal height divs (two column) -

i tried using jquery this, kind of got lost... i'm trying css now http://matthewjamestaylor.com/blog/equal-height-columns-cross-browser-css-no-hacks i want 2 columns, there 2 divs centered nicely in page equal heights, i'm pretty new css sorry if repetitive/obvious question. any appreciated thank you! if trying modify code link, need modify css: #container1 { float:left; width:100%; } #col1 { float:left; width:50%; background:red; } #col2 { float:left; width:50%; background:yellow; } and declare background color hex value , in container itself, unless of course want 2 different color backgrounds columns.

facebook - Show the number of likes from multiple pages -

is possible number of likes on multiple facebook pages , display on webpage. for example if had 4 different pages on site each of teams in school competition. on red teams page want user able red page want show how many likes other teams have. i have reviewed documentation don't seem able find way this. able point me in right direction here? <table> <tbody> <tr> <th>team</th> <th>number of votes</th> </tr> <tr> <td>red team</td> <td> <span>100 <!--display number of likes http://www.facebook.com/redteam --></span> <span class="btn-fblike"> <fb:like href="http%3a%2f%2fwww.facebook.com%2fredteampage" layout="standard" colorscheme="dark" width="320" height="25"/> </span> </td> </tr> ...

model view controller - Issue with MVC architecture in PHP -

i going through concept of mvc in php. i found sample code display hello world. since new this, have no idea how implement mvc architecture radio active buttons or other buttons takes users input , stores in database. the sample code found display hello world follows <?php class model { public $text; public function __construct() { $this->text = 'hello world!'; } } class view { protected $model; protected $controller; public function __construct(controller $controller, model $model) { $this->controller = $controller; $this->model = $model; } public function output() { return $this->model->text ; } } class controller { protected $model; public function __construct(model $model) { $this->model = $model; } } $model = new model(); $controller = new controller($model); $view = new view($controller, $model); echo $view->output(); ?> i have been se...

android - Inneractive ad integration error in xml file -

im trying integrate inner-active app .. downloaded sample project getting error in xml file... multiple annotations found @ line: - error: no resource identifier found attribute 'adtype' in package 'com.inneractive.api.ads.sample' - error: no resource identifier found attribute 'refreshinterval' in package 'com.inneractive.api.ads.sample' - error: no resource identifier found attribute 'keywords' in package 'com.inneractive.api.ads.sample' - error: no resource identifier found attribute 'appid' in package 'com.inneractive.api.ads.sample' xml <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <com.inneractive.api.ads.inneractivead android:id="@+id/...

jquery - notification and messaging system in javascript and php (without the need of having to install additional software serverside) -

i'm running social network messaging , notification feature. each time user sends message or places notification user, row inserted table news_updates details message or notification , friends inserted news_seen table. (once message read, or item related notification opened, seen set 1, i'm doing @ end of callback function ajax request - i'm gathering newsitem_ids news items, open , i'm doing big insert newsitem_ids in it). news_seen: newsitem_id bigint, user_id big int, seen int default '0' at moment, i'm running ajax request every 3 seconds, check news_updates join news_seen news. this turns out huge server load i'm getting more , more users. i've been reading lot xmpp , , think push notification service great site. the thing is, can't decide on way go, since there many options. also, thought creating own system. i'm planning this: create xml file each user on initial registration (and run batch registered users) once us...

rss reader - Creating an RSS feed for a constantly updated website -

possible duplicate: writing program automatically updates data it's released i need able receive notification when information on this website new york fed updated - information sensitive company work for. data can found in xml here , , can exported excel via link right next xml 1 well. with said, have pretty no clue start. guess requires kind of rss feed, that's why tagged rss question, don't know if that's best way go it. basically, end goal have program notify me whenever website got updated new fed securities lending rates, , print 10 recent day's data sort of text file. write sql file upload our database pretty easily. i know pretty vague question, if have idea should start, appreciated. hope able in c++ or c#. actual code or methodology appreciated if know should done. there several tools can use achieve this. here site provides descriptions , links several of them: tracking web page changes i hope helps!

c - Why does this define macro perform a cast? -

i have function-like macro takes in enum return code , function call. #define handle_call(result,call) \ { \ result callresult = call; \ result* resultvar = (result*)result; \ // additional processing (*resultvar) = callresult; \ } while(0) does fancy pointer casting result* , subsequent de-referencing gain anything? is, there advantage doing on just: callresult = call; // additional processing *result = callresult; the macro used this: result result; handle_call(&result,some_function()); by way, isn't code , i'm not power c user i'm trying understand if there logic behind doing this. i think gives you, user of macro can pass in pointer of old type, not result* . i'd either way, or if wanted allow (for example) void* macro argument i'd write *(result*)(result) = callresult; . there's thing might be, depending rest of macro looks like. "some additional processing" mention resultva...

mod rewrite - Redirect old page url after .htaccess url rewriting -

i have rewrited url's htaccess , want redirect old url's new ones, can't figure out how after all. this redirect rule used: rewriterule ^page/([^/]*)/$ /page.php?name=$1 [l] the old url's this: page.php?name=page-name the new url's this: /page/page-name/ that's bit complex when want redirect url parameters. here's trick : rewriterule ^page\.php$ %{query_string} [c] rewriterule name=(.*) /page/$1/? [r=301,l] explainations : first, redirect page.php?name=page-name ?name=page-name then, ask using following rule result (with [c] tag) third, redirect page-name , picked (.*) page/page-name/ last trick, if don't put last ? , query string appended result , you'll have kind of url : page/page-name/?name=page-name . using useless ? erase old parameters. found informations here : apache mod_rewrite doc how strip query string

Alternative to Throwing Param Exceptions in PowerShell? -

bottom line front i'm looking method validate powershell (v1) command line parameters without propagating exceptions command line. details i have powershell script uses param in conjunction [validatenotnullorempty] validate command line paramaters: param( [string] [validatenotnullorempty()]$domain = $(throw "domain (-d) param required.") ) we're changing paradigm of error handling no longer want pass exceptions command line, rather provide custom error messages. since param block can not wrapped in try catch block, i've resorted like following: param( [string]$domain = $("") ) try{ if($domain -like $("")){ throw "domain (-d) param required." } ... }catch{ #output error message } my concern we're bypassing of built-in validation available using param . new technique reasonable solution? there better way validate command line params while encapsulating exceptions within script? i'...

c# 4.0 - tab multiple selected lines of wpf textbox c# -

i facing problem text box control in wpf application. problem when user selects multilines of text , clicks on tab, selected lines deleted instead of being indented right. there way solve issue? appreciate help. ahmad you need handle in code behind not default action of textbox. many ways can handle it. need override previewkeydown , can set e.handled true in order text not overridden. private void textbox_previewkeydown(object sender, system.windows.input.keyeventargs e) { textbox tbx = sender textbox; if (e.key == key.tab) { tbx.text = tbx.text.insert(tbx.selectionstart, "\t" + tbx.text.substring(tbx.selectionstart)); e.handled = true; } }

ios - Proper Memory Management for this line? (Cocos2D) -

i getting following line leak in xcode: somesprite = [[ccsprite alloc] initwithfile:(nsstring*)obj]; i know alloc there thought cocos2d handled of memory management. anyway how should handle line in order there not leak? should use autorelease or there more it? thanks! usually, more preferable use static constructors return autoreleased objects. case be [ccsprite spritewithfile:(nsstring*)obj]; it retained when add parent

spine.js - SpineJS and RequireJS -

i using require.js 2.0. i have following code called require: app.js requirejs.config({ paths: { app: '..', spine: 'spine_src/spine', cs: "cs", }, shim: { 'spine_src/route': { deps: ['spine'] } } }); // start main app logic. requirejs(['cs!app/startapp_admin', 'spine','spine_src/route'], function (startapp_admin, spine, route) { { new startapp_admin(); } }); and following controller: startapp_admin define () -> class startapp_admin extends spine.controller constructor: -> @routes "/twitter/:id": (params) -> console.log("/users/", params.id) spine.route.setup() when execute application following error in spine route library file ( route.js ). application breaks when call spine.route.setup() uncaught typeerror: object function (element) {return e...

Login Vb.net with Browser -

i doing website login , having problem checking if login successful, because using completed document already. when make check see if logout button exists, page hasn't finished loading. here code: imports system.net imports system.text imports system.io public class form1 private sub futurebutton2_click(byval sender system.object, byval e system.eventargs) handles futurebutton2.click if textbox1.text = ("") or textbox2.text = ("") or textbox3.text = ("") or textbox4.text = ("") or textbox5.text = ("") or textbox6.text = ("") msgbox("some information missing please fill boxes") else webbrowser1.navigate("http://combatarms.nexon.net/support/userabuse.aspx") form2.show() end if end sub private sub webbrowser2_documentcompleted(byval sender system.object, byval e s...

objective c - Trying to install Xcode 3.2.6 on a Lion machine but it won't install correctly (Not Date issue) -

so have objective-c code created in xcode 3.1 on osx 10.5.8, , no run in xcode 4. used handy little guide http://hints.macworld.com/article.php?story=20110318050811544 on 1 of 10.7.4 box , worked swimmingly. (i had upgraded 10.6). so trying same, install 3.2, install 4, link sdks etc on machine running 10.7.3, , after using little date hack same 3.2 mpkg used on other computer, installer says finishes when go look, xcode isn't installed anywhere, , directory mentioned in instructions linked above /developers/sdks doesn't exist (it did on other computer). tried copying 10.5 sdk 10.7.4 machine 10.7.3 machine , still nothing, 4 won't run it, , error. ld: cannot link directly /applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.6.sdk/usr/lib/libcrypto.0.9.7.dylib architecture i386 clang: error: linker command failed exit code 1 (use -v see invocation) a little history too, 10.7.4 machine had xcode 3 installed on previo...

java - Bypass layout for a component in Swing without null layout -

is there way bypass layout manager given component in swing? similar position="absolute" in css. null layout not option. i have existing gui can't modify , uses different kinds of layouts , need add button top right corner of screen. if can't modify existing gui, including top-level containing jframe , might out of luck. if can modify root container, can achieve want layered pane . can put existing jtabbedpane in lower layer, , add button on higher layer (and there can use null layout + setlocation() ).

c# - wcf architecture -

what need: a listener can accept http messages contain information in url parameter. listener needs send data parameters part of app (another project). what know: i think creating wcf service best way go don't see how structure it. need 2 services - 1 accepts http messages , 1 sends information app? i want make http listener project since think can reused other applications. the recommended way .net interprocess communication use wcf. since going have implement wcf service in second project anyway (to listen passed parameters http listener), might listen directly in project imho. there seems little point in creating separate listener unless listener going talk different apps @ same time (ie single input point external clients). edit : better explain: what propose: http listener app other app --http--> wcf service -----ipc--> wcf service propose: other app --http--> wcf service

ajax - Script like google suggest in python -

i writing script works google suggest. problem trying suggestion next 2 words. example uses txt file working_bee.txt. when writing text "mis" should suggestions "miss mary , miss taylor, ...". "miss, ...". suspect ajax responsetext method gives single word? ideas wrong? # looks google suggest def count_words(xfile): frequency = {} words=[] l in open(xfile, "rt"): l = l.strip().lower() r in [',', '.', "'", '"', "!", "?", ":", ";"]: l = l.replace(r, " ") words += l.split() in range(len(words)-1): frequency[words[i]+" "+words[i+1]] = frequency.get(words[i]+" "+words[i+1], 0) + 1 return frequency # read valid words file ws = count_words("c:/mod_python/working_bee.txt").keys() def index(req): req.content_type = "text/html" return '...

Google analytics Demographics map in asp.net -

does possible integrate google analytics demographics map in asp.net mvc 4 web site? recently had task add map google analytics' 1 own website. , made using jvectormap . pretty easy integrate , use (though have few minor issues , outdated samples). in case need display ga's data can fetch using ga api , display on map.

why my ListViewItem can't be edit in c# class ListView -

i've tried find answers on msdn failed. here code: listview listview1 = new listview(); listview1.bounds = new rectangle(new point(10, 10), new size(300, 200)); listview1.view = view.details; listview1.labeledit = true; //set here listview1.allowcolumnreorder = true; listview1.checkboxes = true; listview1.fullrowselect = true; listview1.gridlines = true; // show grid listview1.sorting = sortorder.ascending; this allow me edit first column of list view. because first column label of each list view item. what want edit every gird(list view item). suggestion? try that: listview listview1 = new listview(); listview1.view = view.details; listview1.labeledit = true; listview1.columns.add("item column", -2, horizontalalignment.left); listview1.columns.add("column 2", -2, horizontalalignment.left); listview1.items.addrange(new listviewitem[]{"",""}); listv...

Diagnostic monitor for 3 roles (Windows Azure) -

i'm working on project 3 roles (two webroles , 1 workerrole) deployed in windows azure. my problem when instances try start diagnostic monitor (for trace). starting diagnostic monitor workerrole works fine, webroles throw "unhandled exception" when try start during deployment. i use same configuration roles there no problem it. thanks, what storage account using? devstorage chance? if so, you'll need provide real azure storage account

android - How to align text on both left and right side of one TextView line? -

i want set text in single line textview on both left , right side of line. use spannablestringbuilder. here example : mspannablestringbuilder.append("leftright"); mspannablestringbuilder.setspan(new alignmentspan.standard(alignment.align_normal), 0, 3, spannable.span_exclusive_exclusive); mspannablestringbuilder.setspan(new alignmentspan.standard(alignment.align_opposite), 4, 8, spannable.span_exclusive_exclusive); mtextview.settext(mspannablestringbuilder, buffertype.spannable); but doesn't work ... suggestions please ? you i use in xml file below <relativelayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:gravity="center_horizontal" > <textview android:text="aaa:" ...