Posts

Showing posts from June, 2011

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

jquery - How get size of element with hidden parent? -

1.4.4 return size of hidden element, element in hidden element? there better solution getwidth? <script type="text/javascript"> function getwidth(element){ var parent = element.parent(); $('body').append(element); var width = element.width(); parent.append(element); return width; } $(function(){ var width = $("#foo").width(); console.log(width); //0 width = getwidth($("#foo")); console.log(width); //ok }); </script> <div style='display:none'> <div style='display:none' id='foo'>bar</div> </div> when elements hidden, width may vary depending on styling. , when hidden element inside hidden element, results vary again. however, jquery code quite straightforward: $('#foo').parent().width() this grab foo

java - How do you use variable arguments to wrap a certain function taking an Object[] -

i have method takes key , associated parameters in following format. public string foo(string key, object[] parameters) {..} i prefer pass parameters using variable argument format. how should that? i tried public string foo(string key, object... parameters) {..} - seems collide method definition given above. should following , wrap object[] method? public string foo(string key, object a) {..} public string foo(string key, object a, object b) {..} public string foo(string key, object a, object b, object c) {..} just change definition of existing function to public string foo(string key, object... parameters) {..} the variadic method mechanism in java syntactic sugar creating array @ call site , passing in. method should compatible existing source code and compiled classes. from the java documentation on varargs : the 3 periods after final parameter's type indicate final argument may passed array or sequence of arguments.

html - Change label text using Javascript -

why doesn't work me? <script> document.getelementbyid('lbltipaddedcomment').innerhtml = 'your tip has been submitted!'; </script> <label id="lbltipaddedcomment"></label> because script runs before label exists on page (in dom). either put script after label, or wait until document has loaded (use onload function, such jquery ready() or http://www.webreference.com/programming/javascript/onloads/ ) this won't work: <script> document.getelementbyid('lbltipaddedcomment').innerhtml = 'your tip has been submitted!'; </script> <label id="lbltipaddedcomment">test</label> this work: <label id="lbltipaddedcomment">test</label> <script> document.getelementbyid('lbltipaddedcomment').innerhtml = 'your tip has been submitted!'; </script> this example (jsfiddle link) maintains order (script first, label) , uses o

fullscreen - Android: How to fade out search / home / menu / back buttons? -

i'm using android (archos 43) extended display in industrial application. need single program display data received, , send user inputs bluetooth. little program should start directly after booting , should disable (fade out) android-buttons (search, home, menu , back). here's problem: i know, there applications can fade out these search/home/menu/back-buttons (like deskclock or videoplayers), how work? using: android:theme="@android:style/theme.light.notitlebar.fullscreen" only disables titlebar, not 4 android-buttons. it's not android-problem, special feature archos 43 internet tablet. androidmanifest.xml : <uses-permission android:name="archos.permission.fullscreen.full" />

algorithm - Python usage of breadth-first search on social graph -

i've been reading lot of stackoverflow questions how use breadth-first search, dfs, a*, etc, question optimal usage , how implement in reality verse simulated graphs. e.g. consider have social graph of twitter/facebook/some social networking site, me seems search algorithm work follows: if user had 10 friends, 1 of had 2 friends , 3. search first figure out user a's friends were, have friends each of ten users. me seems bfs? however, i'm not sure if that's way go implementing algorithm. thanks, for 2 cents, if you're trying traverse whole graph doesn't matter whole lot algorithm use long hits each node once. seems you're saying when note: i'm trying traverse whole graph this means terminology technically flawed- you're talking walking graph, not searching graph. unless you're trying search in particular, don't seem mention in question @ all. with said, facebook , twitter different graph structures have impac

Java Server socket stuck on accept call (Android Client, Java Server) -

below have put fragment of code understand problem. have server code, works fine first time client loads , sends packet. after first packet received, server stuck on "accept". i have wireshark configured port, , server getting packets. wonder why accept wont return more once. driving me nuts. server code public class dapool implements runnable { private serversocket serversocket; private arraylist<da> pool; private linkedlist<socket> clientconnq; public dapool(int newpoolsize, int serverport) { try { serversocket = new serversocket(serverport, 500, inetaddress.getbyname("127.0.0.1")); } catch (ioexception e) { e.printstacktrace(); return; } poolsize = newpoolsize; clientconnq = new linkedlist<socket>(); pool = new arraylist<da>(poolsize); da devicethread; (int threads = 0; threads < poolsize; threads++) { devicethread = new da(); connpool.add(devicethread); devicethread.start()

class - LaTeX: \newenvironment with only one optional arg (and no mandatory) -

try set new environment within class take optional argument, or none. this used : \begin{myenv} --> "label:" or \begin{myenv}[mylabel] --> "label: mylabel" i try define environment basic macros. rather not use xparse package. i have found several examples of \newenvironment optional argument mandatory one. not need mandatory argument! is there way \newenvironment or \def macros ? no problem, declare environment 1 argument, , make optional: \documentclass{minimal} \newenvironment*{myenv}[1][]{% label: #1% \par \ignorespaces }{% \par end% \par \ignorespacesafterend } \begin{document} \begin{myenv} abc \end{myenv} \begin{myenv}[mylabel] abc \end{myenv} \end{document}

javascript - parent.window.location redirection from spring mvc modelandview -

my application consists of few iframes. in spring mvc there way redirect parent page instead of current iframe? example in javascript can parent.window.location load page in parent instead of using window.location load in iframe. the following view loads login.go in current iframe, want login.go displayed in whole page (parent) return new modelandview(new redirectview("/login.go", false, true, true)); any ideas please.. this reason why frames evil. it's not possible break out of frame without using javascript.

iphone - UITextfield validation -

i trying validate text fields. have 2 textfields username , password. want check if username textfield kept empty not allow user move password textfield until enters username. sample code appreciated. thanks in advance. you make username textfield firstresponder.then in textfield did beginediting method check if characters entered or not.and in textfielddidendediting,check if textfield not empty.if not empty allow password field become first responder else keep first responder username textfield itself.

java - File.getCanonicalPath() failure examples -

does have experience or know when method file.getcanonicalpath() throw ioexception i have tried internet , best answer in file api says " ioexception - if i/o error occurs, possible because construction of canonical pathname may require filesystem queries" however, not clear me because still cannot think of case might fail. can give me concrete examples can happen on linux, windows , other os (optional)? i reason want know because want handle exception accordingly. thus, best if know possible failures can happen. here windows example: try calling getcanonicalfile on file in cd-drive, without cd loaded. example: new file("d:\\dummy.txt").getcanonicalfile(); you get: exception in thread "main" java.io.ioexception: device not ready @ java.io.winntfilesystem.canonicalize0(native method) @ java.io.win32filesystem.canonicalize(win32filesystem.java:396) @ java.io.file.getcanonicalpath(file.java:559) @ java.io.file.

Layout Designer - Drag and Drop in PHP -

i build layout designer in php or use readymade script( if paid 1 ) basically create sort of layout users choose fields add "field chooser". each field of type... , provide field group too, user choose number of columns, , make columns of "panel" droppable. we should drag field list, , drop field placeholder on form (panel?). finally, possible "read" form layout in order store later use? thanks kabir yes there drag , drop form/window designer php - since 2007 the delphi php ide . become part of radphp x2 ide available embarcadero . both use delphi vcl framework.

XML within an Android string resource? -

i wondering if place xml within /res/values/strings.xml ? ask because checking xml data file application, if not exist yet creates default contents contained string resource. eclipse tries change less , greater tags corresponding html entities when using gui edit strings. eclipse on right track? because should think written out file html entities too. use gettext() rather getstring() convert entities tags? thanks advice can give. yes can, use cdata <string name="stringname1"><![cdata[<html>bla</html>]]></string>

objective c - Multiple NSXMLParser calls -

i use api call returns xml file. need use same multiple times. e.g. on click of search button, call http://xyz.com/s1/?para1=srch then in different view, call http://xyz.com/s2/?para2=set2 how should implement same? mean should xmlparser file common both requests , if..else element names should mixed in single implementation of parser:didendelement? please me example. sure, can re-use parser if page elements same. make method in parser's class can feed location or xml file, , have parse file. like: -(void)parseforecast:(nsdata *)data; { nsxmlparser *parser = [[nsxmlparser alloc] initwithdata:data]; [parser setdelegate:self]; [parser parse]; [parser release]; } should trick.

php - Recursive delete -

i have code recursive delete files , directories. works fine has little problem. if $path = /var/www/foo/ delete inside of foo, not foo. want delete foo directory too. idea? public function delete($path) { if(!file_exists($path)) { throw new recursivedirectoryexception('directory doesn\'t exist.'); } $directoryiterator = new directoryiterator($path); foreach($directoryiterator $fileinfo) { $filepath = $fileinfo->getpathname(); if(!$fileinfo->isdot()) { if($fileinfo->isfile()) { unlink($filepath); } else if($fileinfo->isdir()) { if($this->emptydirectory($filepath)) { rmdir($filepath); } else { $this->delete($filepath); rmdir($filepath); } } } } } why recurse in function? public function delete($path) {

class - Calling another ruby file that is not a gem -

i want create static ruby class library of function. on vista ruby 1.9.2 my class 1 : class testclass def say_hello puts "say hello" end end in testclass.rb file (i assume correct ruby tutorials on classes complete mess putting in single magic (file?) if irb begining , end of thing). my ruby main() (yes come java) or program entry or wathever called in ruby : require 'testclass.rb' puts "start" say_hello but fails : c:\ruby_path_with_all_my_classes>ruby classuser.rb <internal:lib/rubygems/custom_require>:29:in `require': no such file load -- testclass.rb (loaderror) <internal:lib/rubygems/custom_require>:29:in `require' classuser.rb:1:in `<main>' how work? possible call other files in ruby or trapped in 1 file containing classes? in 99% of cases when computer tells couldn't find thing, because thing isn't there. so, first thing need check whether there is file named te

javascript - How to translate whole website by google transltion? -

this code : <div id="wrap"> ⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯ ⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯ </div> <script type="text/javascript"> google.load("language", "1"); google.setonloadcallback(submitchange); var wrap_text = ''; function submitchange(){ wrap_text = document.getelementbyid('wrap').innerhtml; google.language.translate(wrap_text, 'zh-cn', 'zh-tw', function(result) { var resultbody = document.getelementbyid('wrap'); alert(result.translation); if (result.translation){ resultbody.innerhtml = result.translation; } else { resultbody.innerhtml = wrap_text; } }); return false; } </script> it not work, if replace wrap_text words, works. who can me, thanks! i think have escape work, @ least that's did in example code: var sourcetext = escape(document.getelementbyid("sourcetext").innerhtml); see: ht

data mining - Python Parsing Framework -

if needed facilitate extraction of data various (non-api) internet sources, there framework-type solution streamline process of having developers write reusable, yet source specific parsers on large scale? pyparsing python library i've found useful parsing custom domain specific languages.

python - Drawing fast lines in pygame -

i'm trying draw fast lines using pygame aren't rendered directly screen. i've got python list large number of pixels desired resolution, , store integer values corresponding number of times pixel hit line algorithm. using this, 2d heat map built up, rather drawing flat pixel value, pixel values incremented based on number of times line runs through it, , "hot" pixels brighter colours. the reason doing way don't know in advance how many of these lines going drawn, , maximum number of times given pixel going hit. since we'd scale output each rendering has correct maximum , minimum rgb values, can't draw screen. is there better way draw these lines relatively naive bresenham's algorithm? here's critical part of drawline function: # before loop, save repeated multiplications xm = [] in range(resolution[0]): xm.append(i * resolution[0]) # inside of drawline, index f list, of size resolution[0] * resolution[1] x in range(

What do I need to do to compile Android NDK (C++) aps in Visual Studio 2010? -

Image
i've read in different places possible. not need debug, compile. walkthrus out there? thx. found links: android ndk visual studio - "we've got partially working, use visual studio build, using proper android headers , whatnot, call ndk build scripts. we're working on automating second half post-build step" http://groups.google.com/group/android-ndk/browse_thread/thread/9f3a55366ba08f2a/cb539c80e5729032 - "you have dig out proper parameters tools, assure works me on command-line (well in various bat files called ms visual studio)." building , debugging android apps within visual studio ok. no need mess eclipse, or post build steps. i've got running myself, here screenshot: http://www.gavpugh.com/2011/02/04/vs-android-developing-for-android-in-visual-studio/ in case "unable locate tools.jar. expected find in c:\program files (x86)\java\jre6\lib\tools.jar" can add environment variable java_home points java jdk p

php - Cron Jobs stopped working -

i've been running daily cron job few months , working fine. cron job runs php script database action mails email address results. few days ago, when script ran, database action stopped working, send me email. changed php script send different email, still sends me old one. can't seem new scripts run , when set email address cron job run doesn't send one. any thought how can on track? more information: use linux os cpanel. i've used following commands. /usr/bin/php -f /home/[user]/public_html/[path script] /usr/bin/php -q /home/[user]/public_html/[path script] /usr/local/bin/php -f /home/[user]/public_html/[path script] /usr/local/bin/php -q /home/[user]/public_html/[path script] php says path php /usr/bin/php however, used work local part in there. @dampes8n- i'd rather not. php script includes few sql commands , mail function. works fine without errors when visited browser. @paul- inclined believe. think cron daemon stuck somehow. when try add new cr

jquery - ajax post method not working in vb.net -

i using jquery using ajax post data, reason when click on submit, page doesnt go aspx aspx.vb on side. here's code - $(document).ready(function() { $("#btnsave").click(function() { var firstname = $("#" + '<%=firstname.clientid%>').val(); $.ajax({ type: "post", url: "student.aspx/new_class", data: "firstname="+ firstname + ";", contenttype: "application/json; charset=utf-8", datatype: "json", success: function() { } }); }); }); new_class webmethod in vb.net side. if put alert in btnsave onclick function, see firstname value in alert. page not call new_class function after that. ideas i'm going wrong? that url incorrect mapping method on server-side code. i assume you're trying call method called new_c

jqGrid client-side searching -

i manually apply searching jqgrid via javascript. have tried guide here , can't seem working. in grid setup have column name 'error_column' perform search on looking string 'test'. here have far: var filter = { "field": "error_column", 'oper': 'eq', "data": 'test' }; $("grid2").jqgrid('setgridparam', { search: true, postdata: { filters: filter} }) $("grid2").trigger('reloadgrid'); when click button bound to, nothing happens , causes no errors. edit here code initializing grid: jquery("#grid2").jqgrid({ datatype: "local", height: 250, colnames: ['newsubscriberid', 'conflicting subscriber id', 'error field', 'error message'], colmodel: [ { name: 'new_subscriber_id', index: 'new_subscriber_id', width: 120}, { name: 'conflicting_subscriber_id', index: 'conf

asp classic - Help convert .asp to .php -

how can rewrite .asp .php? <% ' url of webpage want retrieve thisurl = "pagerequest.jsp" ' creation of xmlhttp object set getconnection = createobject("microsoft.xmlhttp") ' connection url getconnection.open "get", thisurl, false getconnection.send ' responsepage have response of remote web server responsepage = getconnection.responsetext ' write out content of responsepage var response.contenttype = "text/xml" response.write (responsepage) set getconnection = nothing %> how? need learn php , write it. if know php, suspect you'll want investigate: whether or not have remote file_get_contents support. (see other answers.) failing that, whether or not can use curl functions, although should first check production environment has curl support. (if doesn't, you'll need rectify this.) failing of those, you'll need create socket connection , send relevant http headers request re

haskell - Neural Network Always Produces Same/Similar Outputs for Any Input -

i have problem trying create neural network tic-tac-toe. however, reason, training neural network causes produce same output given input. i did take @ artificial neural networks benchmark , network implementation built neurons same activation function each neuron, i.e. no constant neurons. to make sure problem wasn't due choice of training set (1218 board states , moves generated genetic algorithm), tried train network reproduce xor. logistic activation function used. instead of using derivative, multiplied error output*(1-output) sources suggested equivalent using derivative. can put haskell source on hpaste, it's little embarrassing at. network has 3 layers: first layer has 2 inputs , 4 outputs, second has 4 inputs , 1 output, , third has 1 output. increasing 4 neurons in second layer didn't help, , neither did increasing 8 outputs in first layer. i calculated errors, network output, bias updates, , weight updates hand based on http://hebb.mit.edu/courses/9.641

.net - CQRS - Read Model DTO Confusion -

i have been reading on cqrs , find many of principles valuable. however, have 1 major point of contention. many people talk having read model queries map directly view model dtos. far, good. however, "one table or 1 select per view" come hear? sure, screens map 1-1 easily. routinely work complex screens involve multiple selects things reference data in drop down lists, widgets, etc... i see views needing multiple selects, maybe join or two. how can possibly avoid this, aside working perfect world scenarios views simple , flat? but routinely work complex screens involve multiple selects things reference data in drop down lists, widgets, etc... select lists, widgets, etc. can view these each view nested in view (possibly obvious if own partial). when viewed way, can each have own query.

flex and data concurrency -

i embark on medium scale project. although isn't high priority in large list of things have been trying of how affectively handle data concurrency. using stateless ejb backend flex application. ideally looking simple method deal data concurrency. e.g. if data saved on 1 interface refreshed in another. or warns data has been changed before saving new version of data. has ideas @ loss @ moment. mentioned not high priority feel lot better if had mechanism improve process. if planning on using amf channels communication can use long polling feature give application "push message" type support. both blazeds and/or graniteds data services support capability reasons mentioned.

Azure: How to create the WADLogsTable for capturing diagnostics code? -

i have worker role diagnoistics feedback on... after adding appropriate connection string serviceconfiguration.cscfg , following code: //diagnosticmonitor.start("diagnosticsconnectionstring"); diagnosticmonitorconfiguration diagconfig = diagnosticmonitor.getdefaultinitialconfiguration(); diagconfig.windowseventlog.datasources.add("application!*"); diagconfig.windowseventlog.scheduledtransferperiod = system.timespan.fromminutes(5.0); diagconfig.logs.scheduledtransferperiod = system.timespan.fromminutes(5.0); microsoft.windowsazure.diagnostics.diagnosticmonitor.start("diagnosticsconnectionstring", diagconfig); crashdumps.enablecollection(true); when call "system.diagnostics.trace.traceinformation("test log") expect able find record in wadlogstable of target azure storage account. howver, table doesn't exist- how created? none of documentation i've read covers this. in advance, you'll want set log level filter,

How display a loading image correctly on Android phone -

i have been trying use .gif file resources, no movement when loads. using loading image while doing asynchronous task. using progress dialog display image myself , not use dialog. how can image display correctly? try using animationdrawable: http://developer.android.com/reference/android/graphics/drawable/animationdrawable.html basically, should split each of frames in gif separate files - such .png file (say if had transparency) , specify these files in <animation-list> instead. can control duration of each frame. see link code example

sql - Fetching first records of sets matching a where condition in Rails -

i want create method activity model has many practices called month_days_not_practiced gives count of days in current month activity not have practices recorded (note: days_in_month helper method): def month_days_not_practiced(date = date.today) p = practices.where(:created_at => date.at_beginning_of_month..date.at_end_of_month).count days_in_month - p end however, want return 1 record per month day. can me custom sql (i think) please? i'm drawing blank @ moment.. tia! andy put on end of query: .group("date(created_at)")

GWT composite dynamic height resize -

i have gwt composite other composites added dynamically. want make may parent composite resize fit height of child widgets automatically. tried setting setheight("100%") composite doesn’t work. idea how accomplish functionality? thanks. edit: final docklayoutpanel docklayoutpanel = new docklayoutpanel(unit.em); docklayoutpanel.setstylename("entrypanel"); docklayoutpanel.setsize("142px", "72px"); initwidget(docklayoutpanel); final verticalpanel panel = new verticalpanel(); panel.setsize("140px", "72px"); chckbxexport = new checkbox("export"); putfield(commonpresenter.constants.export, chckbxexport); datebox = new datebox(); datebox.addvaluechangehandler(new valuechangehandler<date>() { @override public void onvaluechange(final valuechangeevent<date> event) { datechanged = true; } }); panel.add(datebox); final

mysql concat function -

when concat($name, $surname) , there way of putting space in between $name $surname using sql not php when result formats little cleaner? many thanks you can concatenate string literals along fields, can add space character in string between fields you're concatenating. use this: concat(name, " ", surname) this functionality documented quite on mysql manual page concat() function . there concat_ws function allows specify separator used between each of other fields passed function. if you're concatenating more 2 fields in same way, function might considered cleaner repeating separator between each field. for example, if wanted add middle name field, use function specify separator once: concat_ws(" ", first_name, middle_name, surname)

Animate Listbox Items in Silverlight -

i'm trying add sort of animation items they're added listbox, blog purports link the trouble is, when add visualstategroup beforeloaded , loaded state names, items fail render @ in listbox. blue highlighting when hover, , brighter blue when click select, actual content of listbox item (the random rectangle) absent. when remove group, rectangles render perfectly, without sort of animation (obviously). attached complete style itemcontainerstyle of listbox. rest of code verbatim link. <style x:key="listboxitemstyle1" targettype="listboxitem"> <setter property="padding" value="3"/> <setter property="horizontalcontentalignment" value="left"/> <setter property="verticalcontentalignment" value="top"/> <setter property="background" value="transparent"/> <setter property="borderthickness"

Entity Framework: reload all child entities from query based on child entity attributes -

is there way elegantly load child entities of ef entity if entity instance loaded result of query on child entity attributes? here simple example of i'm asking: first, simple data tables: create table invoices ( invoiceid int identity(1000,1) not null, customer nvarchar(50) not null, invoicedate datetime not null, constraint pk_invoices primary key (invoiceid) ) create table invoiceitems ( invoiceitemid int identity(1,10) not null, invoicefk int not null, purchaseditem varchar(24) null, quantity decimal(10,2) null, itemprice money null, constraint pk_invoiceitems primary key (invoiceitemid), constraint fk_invoiceitems_invoice foreign key (invoicefk) references invoices (invoiceid) ) now, want query invoice table based on matching invoice item, show items each selected invoice regardless of whether matches criteria: var qryorders = ordr in ctx.invoiceitems .include("invoice")

gradient background not working in Chrome with -webkit-gradient -

greetings all, i'm using gradient background -webkit-gradient. it's not working on chrome 8.0.552.224 on windows 7, swear working on chrome-os x. it's monday perhaps i'm missing obvious, if can't figure out. i'd appreciate taking look. sample code here work on firefox doesn't display gradient in chrome: thanks, -northk <!doctype html> <html lang="en"> <head> <title>gradient test </title> <style> .main-header { padding-top: 50px; min-height: 50px; background: -webkit-gradient(linear, 0%, 0%, 0%, 100%, from(#fff), to(#000)); background: -moz-linear-gradient(top, #fff, #000); border: 1px solid #000; } </style> </head> <body> <div class="main-header"> works on firefox doesn't work on chrome-windows 7! </div> </body> </html> seems

php - jquery autocomplete: works for first value, how to enable it for next? -

i'm using autocomplete user can easly enter data on inputs, this: <? $a = new etiqueta(0, ''); $b = $a->autocomplete_etiquetas(); ?> <script type="text/javascript"> function cargar_autocomplete_etiquetas(){ $("#tags").autocomplete({ source: [<? echo $b; ?>] }); } </script> $a = $b array result like: 'help','please',i','need','to,'be able to', 'select next item',' autocomplete'; and checked ui documentation, doesn't fith source method.. idea? i'm trying (edited bugai13 aportation): <? $a = new etiqueta(0, ''); $b = $a->autocomplete_etiquetas(); ?> <script type="text/javascript"> function cargar_autocomplete_etiquetas(){ $("#tags").autocomplete({ source: [<? echo $b; ?>], multiple: true, multipleseparator: ", ", ma

ios - FBSessionDelegate methods not firing -

i'm attempting implement latest facebook connect sdk , i'm having troubles. reason delegate callbacks fbsessiondelegate protocol not being fired. i've followed instructions on git facebook page , tried mimic facebook sample app no luck. i'm going crazy here i'm gonna post code , maybe see silly i've missed. #import <foundation/foundation.h> #import "fbconnect.h" @interface facebookwrapper : uiviewcontroller <fbsessiondelegate, fbrequestdelegate, fbdialogdelegate>{ facebook* _facebook; nsarray* _permissions; } @property(readonly) facebook *facebook; - (void)login; @end #import "facebookwrapper.h" static nsstring* kappid = @"1234455667778"; @implementation facebookwrapper @synthesize facebook = _facebook; - (id)init { if (self = [super init]) { _permissions = [[nsarray arraywithobjects: @"read_stream", @"offline_access",nil] retain]; _facebook = [[facebook alloc] initwithappid:ka

PHP session side-effect warning - how to get solve? -

i'm new php, , sure easy, i'd right way. have script: <?php if ($_post["username"]=="") { include($_server['document_root'] ."/login.inc.php"); } else { $username=$_post["username"]; $password=$_post["password"]; session_start(); if ($username=="bob" , $password=="123"){ $permission="yes";} $username=$_post["username"]; session_register("permission"); session_register("username"); if ($permission=="yes"){ // show stuff } } ?> excuse funky formatting of code - can't seem show properly. so, keep getting error: warning: unknown: script possibly relies on session side-effect existed until php 4.2.3. please advised session extension not consider global variables source of data, unless register_globals enabled. can disable functionality , warning setting session.bug_compat_42 or

.net - Tips/Resources on Structuring Shared Code Libraries in C#/WPF? -

i've written simple desktop application c#/wpf , i'm looking create another, larger application share of functionality. i'm thinking should create 3 separate projects: 1 containing shared code, , 1 each 2 apps. my problem i'm not entirely familiar .net/wpf don't know if there best practices sort of thing. can offer sources of information, example projects or brief advice? edit: put little more detail on scenario, first application specialised editor , second application taking file editor , wrapping project model around create sort of basic ide. honestly depends on level code intend share is. instance, it's entirely plausable put of business logic code 1 project/class library , maintain independantly, mixing biz logic wpf custom controls should discouraged. think layers of abstraction modularizing, , dependancy heiarchy introducing , refactor accordingly. edit: in response above changes suggest following: logic , dal associated above shou

vb6 - How to modify the value in the database -

using sql server , vb6 table1 date time 20090801 060000 20090802 162000 date format: yyyymmdd time format: hhmmss date & time column datatype varchar when select date in datetimepicker , modify time. should update in table. expected output 01-08-2009 (datetimepicker value) 080000 (textbox value) the above value should update in table how make code above condition. need code help. try this. dim strdatetime string strdatetime = format$(datetimepicker.value, "mmddyyyy mmhhss") update our database recordset rs.fields["datetimefield"] = strdatetime rs.update' i hope points in right direction

javascript - Refresh after Facebook like is clicked -

am trying build facebook canvas app (iframe). head section have xfbml (fb:like) mid way thru page have fql call see if user has particular fan page or not (this app linked directly fan page) if user has liked page see x content, if not see y content - part if working fine - part struggling page automatically refresh after user clicks see x content. if manual refresh works so, have tried adding java event subscribe guess monitors page onclick scenario..... this kind of works, firefox pop asking resend data before page refresh. the current app page is: apps.facebook.com/marqueenightclub/ workflow trying emulate similar l'oreal app: apps.facebook.com/menexpertwhiteactiv/ prior clicking content user seesy content, clicking triggers x content any appreciated - regards tony if want full page refresh, eg. if you're doing server-side sdk, can use following code: fb.event.subscribe('edge.create', function(response) { top.location.href = "http://ww

Select a subset of foreign key elements in inlineformset_factory in Django -

i have model 2 foreign keys: class model1(models.model): model_a = models.foreignkey(modela) model_b = models.foreignkey(modelb) value = models.integerfield() then, create inline formset class, so: an_inline_formset = inlineformset_factory(modela, model1, fk_name="model_a") and instantiate it, so: a_formset = an_inline_formset(request.post, instance=model_a_object) once formset gets rendered in template/page, there choicefield associated model_b field. problem i'm having elements in resulting drop down menu include of elements found in modelb table. need select subset of based on criteria modelb. @ same time, need keep reference instance of model_a_object when instantiating inlineformset_factory and, therefore, can't use this example. suggestions? what need change modelchoicefield's queryset the easiest way may monkey-patch formset's form. should able right after constructing formset with: an_inline_formset.form.base_fields[

Set a hidden property to a ListBox Item - C# -

hey, knows way set hidden value listbox item. alternative can use listbox simultaneously. thanks. you looking tag property. holds object type, means can save reference in there. although before setting on using tag property, take @ itemssource. can tie collection of things provider listbox, it's superior alternative dealing listbox items individually.

file upload - How can I save a directory tree to an array in PHP? -

Image
i'm trying take directory structure: top folder1 file1 folder2 file1 file2 and save array like: array ( 'folder1' => array('file1'), 'folder2' => array('file1', 'file2') ) this way, can resuse tree throughout site. i've been playing around code it's still not doing want: private function get_tree() { $uploads = __relpath__ . ds . 'public' . ds . 'uploads'; $iterator = new recursiveiteratoriterator(new recursivedirectoryiterator($uploads), recursiveiteratoriterator::self_first); $output = array(); foreach($iterator $file) { $relativepath = str_replace($uploads . ds, '', $file); if ($file->isdir()) { if (!in_array($relativepath, $output)) $output[$relativepath] = array(); } } return $output; } im horrible recursive functions. managed come this..not s

c# - BackgroundWorker and instance variables -

one thing that's confused me how backgroundworker seems have thread-safe access instance variables of surrounding class. given basic class: public class backgroundprocessor { public list<int> items { get; private set; } public backgroundprocessor(ienumerable<int> items) { items = new list<int>(items); } public void dowork() { backgroundworker worker = new backgroundworker(); worker.runworkercompleted += new runworkercompletedeventhandler(worker_runworkercompleted); worker.dowork += new doworkeventhandler(worker_dowork); worker.runworkerasync(); } void worker_dowork(object sender, doworkeventargs e) { var processor = new processingclass(); processor.process(this.items); //accessing instance variable } void worker_runworkercompleted(object sender, runworkercompletedeventargs e) { //stuff goes here } } am erroneous in assumption the call

css - Removing background color in the form in IE -

am not able remove background color in iframe please me.am running out of precious time :-( though not php related, think seeking answer follows. if have access editing content of page being directed iframe, can use simple css property remove background. try adding head of document: <style type="text/css"> body { background-color:transparent; } </style> if page accessed @ anytime outside of iframe, set php (if-statement should work if set variable) enable/disable bit of code if it's being accessed iframe page. in iframe add parameter allowtransparency="true" so iframe should (copied page) <iframe src="http://www.orangerich.info/crm/freetrialform/form.php" height="360" width="320" frameborder="0" scrolling="no" allowtransparency="true"></iframe> good luck! dennis m.

javascript - How to pass Json collection object to mvc controller action method -

this question has answer here: asp.net mvc how pass json object view controller parameter 6 answers i creating 1 json array object , trying pass in mvc controller action method getting null paramerter; per knowledge json maps .net primitive datatypes.... assign null value. note: when have @ request object found there 3 parameter of created array. how value parameter of function? you need create custom model binder take json value , construct model object can passed action. another option use different value binder. see phil haack's site example.

php search script -

i need search property searching on zameen what unaware of how send query next page? eg query this $query = select * xyz city='a' , location='b' , price between 'c' , 'd' , area between 'e' , 'f' , bedrooms='g' , addedwithin 'h'; considering query on basis of form on above mentioned website, should scenario searching property listings. also how should query again when use paging page. should this <a href="<?php echo $_server['php_self'] . '?q=' . $query; ?>" > nextpage </a> or there other simpler solution? thanks you may store user search phrase e.g. in session coockies or keep in form parameters (e.g. hidden type). db-request again new offset

Html table to csv table with image -

how export html table in csv example table: i want table exported csv .so how achieve using jquery? <html> <body bgcolor="cyan"> <table border="1" align="center" > <br><a href="imp2.csv">click here view in csv format</a><img src="up.jpg" align="middle" width="39" height="32" /> <tr> <th>id</th> <th>name</th> <th>month</th> <th>savings</th> </tr> </table> </body> </html> thanks joseph excel files support embedded images, csv files not. short answer is: can't. theoretically, set location data: scheme uri generate on fly. generating excel file distinctly non-trivial , wouldn't surprised if rapidly ran length limits.

android - Add widget to activity -

hey, i've developped car dock application. can add shortcuts in activity how can add system widget ? you need extend appwidgetprovider class in application. see tutorial here , make sure follow design guidelines .

c strcmp source code -

int strcmp(const char *s1, const char *s2) { int ret = 0; while (!(ret = *(unsigned char *) s1 - *(unsigned char *) s2) && *s2) ++s1, ++s2; if (ret < 0) ret = -1; else if (ret > 0) ret = 1 ; return ret; } i review code : http://www.jbox.dk/sanos/source/lib/string.c.html i suppose there're problem. if strlen(s2)>strlen(s1) ,then ++s1 may beyond range. unfortunately, function return error. no, there's no such problem since loop continues while *s1 , *s2 equal and *s2 not 0. if s1 shorter, once gets \0 @ end of s1, equality condition break , loop stop.

How to perform basic Multiple Sequence Alignments in R? -

(i've tried asking on biostar , slight chance text mining think there better solution, reposting here) the task i'm trying achieve align several sequences. i don't have basic pattern match to. know "true" pattern should of length "30" , sequences have had missing values introduced them @ random points. here example of such sequences, on left see real location of missing values, , on right see sequence able observe. my goal reconstruct left column using sequences i've got on right column (based on fact many of letters in each position same) real_sequence the_sequence_we_see 1 cgcaatactaac-agctgacttacgcaccg cgcaatactaacagctgacttacgcaccg 2 cgcaatactagc-aggtgacttcc-ct-cg cgcaatactagcaggtgacttccctcg 3 cgcaatgatcac--ggtggctcccggtgcg cgcaatgatcacggtggctcccggtgcg 4 cgcaatactaacca-ctaact--cgctgcg cgcaatactaaccactaactcgctgcg 5 cgcacgggtaagaacgtga-ttacgctcag cgcacgggtaagaacgtgattacgctcag 6 cgctatact

performance - How to open 10 browsers with jmeter -

i'm using jmeter performance testing.i used selenium functional testing.i want test 10 users access same login page @ same time.i can jmeter. want open 10 browsers @ same time(like selenium )and display on screen,can using jmeter??is there plugin can use this?? curious...what scenario testing needs ten browsers open on same machine @ once? jmeter can't this, jmeter emulated browser. open ten jmeter instances, give same effect having ten threads in single script. now, if need ten browsers on ten different machines, jmeter can using remote mode.

.net - How do I guarantee node order for an XPath 'OR' query -

i have snippet of xml looks like <body> text.... <nodea>....</nodea> more text <someothernode> <nodea>.......</nodea> </someothernode> <nodeb>.......</nodeb> etc..... </body> i'm selecting nodea , nodeb nodes inside <body> using xpath query similar //nodea|//nodeb as understand it, .net supports xpath 1.0 not guarantee node order. how can guarantee selected nodes returned in document order in or query : that's say: nodea, nodea, nodeb as understand it, .net supports xpath 1.0 not guarantee node order when xpath 1.0 expression selects nodes evaluated, selected nodes form node-set . a node-set set , this, among many other things, means unordered . for practical purposes, though, there 1 main ordering chosen enumerate nodes of node set: document order. in practice, xpath 1.0 engines know (and in .net) return selected nodes in document order. in fut

mysql - db_query in drupal insert the values as question marks -

when use db_query in drupal insert non-english letters (arabic example), appears question marks in db, while if use mysql_query works fine !!! idea , how fix it?? thanks help thanks attention... fixed issue using mysql_set_charset('utf8',$connection);

asp.net mvc - model binding IList of custom object -

i have class contains: public ilist<propertyvalueoperators> filterlist { get; set; } where propertyvalueoperators: public class propertyvalueoperators { public string property { get; set; } public string value { get; set; } public string likeoperator { get; set; } } i have typed view creates form based on class a. have read here: asp.net mvc model binding ilist<> parameter that model binding should able populate lists such filterlist have implemented html helper generates this: <label for="items[0].property">filter by</label> <select id="items[0]_property" name="items[0].property"> <option selected="selected" value="item.id">dbid</option> <option value="category_itemname.name">name</option> </select> <label for="items[0].likeoperator">filter operator</label> <select id=&

Javascript code review - Make element "toggleable" -

i wrote javascript function solves typical problem: given html element, whenever user clicks on html element shown, on click hidden. as not big javascript guru , have started discover real power of javascript, sure there @ least couple of problems code. any feedback highly appreciated. (note i'm using jquery) /** * makes html element given id "targetid" being toggleable * controlled click event of html element id "controlid". * "controlfunction" function should return true/false based * on whether target should showed or hidden. * if there no controlfunction "!targetelement.is(":visible")" used. * controlfunction applied in context of control element (so * "this" going controlelement. * * @param targetid * @param controlid * @param controlfunction * @returns */ var maketoggleableonclick = function (targetid, controlid, controlfunction) { var targetelement, controlelement, showhidevalue;

.net - Strange XML error during SqlBulkCopy -

regrettably it's fallen me fix error in else's code while they're away holiday in spite of having been in job 2 weeks! , it's fun 1 - understanding of i'm working on incomplete i'm hoping community can me out bit. the error occurring when we're trying process external xml file. error we're getting standard " system.xml.xmlexception: there unclosed literal string " line number attached. there's nothing wrong line specified , line number of error changes every time try , process file. i still assumed formatting error wrote little console app runs through xml nodes , dumps values out screen, way of checking whole document valid. ran through lot , hit no errors. introduced deliberate syntax error make sure , program caught it. i'm pretty confident there's nothing wrong source xml. looking @ code error happening it's using sqlbulkcopy isn't i'm familiar with. attempts execute writetoserver method argument of idatare