Posts

Showing posts from June, 2010

tabcontrol - call of the method in mainwindow gives different result when it is called from usercontrol c# -

in mainwindow try navigate through tabcontrol method public void izaberidijagnostiku() { this.tabcontrol1.selecteditem = tabitem3; this.tabitem3.focus(); } and works. but, when call method user control navigation doesn't work. how can navigate through tabs?

database - LOG4J Multiple Loggers in same class -

i have java project has log4j logging. uses rolling file appender , multiple loggers log file. want add dbappender , have seperate logger writes appender, none of other loggers sending messages it. need, 1 class have 2 loggers, 1 writing fileappender , 1 writing dbappender. possible, if configuration it? thanks it's possible use 2 logger s in 1 class. first idea: 2 loggers different names: package com.mycompany.apackage.myclass; public class myclass { private static final logger = logger.getlogger(myclass.class) private static final dblogger = logger. getlogger(myclass.class.getname() + ".dblogger") } config package of dblogger : <root> <appender-ref ref="mainlog" /> </root> <logger name="com.mycompany.apackage.myclass.dblogger"> <appender-ref ref="dbappender" /> </logger> (not tested.) in case dblogger logs mainlog appender. if it's not appropri...

html - Resize Flash Object -

i trying resize height of flash object size of divider. not work, what's wrong here? flash object displayed, it's height 100px. want resize movie later calling js-method flash , change size of div object. <%@ page language="c#" autoeventwireup="true" codebehind="index.aspx.cs" inherits="website.pages.index" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div align="center"> <div id="contentdivider" style="width:780;height:600;"> <object width="780" height="100%"> <embed src="../c...

c# - JavaScript: Alert.Show(message) From ASP.NET Code-behind -

i reading javascript: alert.show(message) asp.net code-behind i trying implement same. created static class this: using system; using system.collections.generic; using system.linq; using system.web; using system.data; using system.data.sqlclient; using system.web; using system.text; using system.web.ui; namespace registration.dataaccess { public static class repository { /// <summary> /// shows client-side javascript alert in browser. /// </summary> /// <param name="message">the message appear in alert.</param> public static void show(string message) { // cleans message allow single quotation marks string cleanmessage = message.replace("'", "\'"); string script = "<script type="text/javascript">alert('" + cleanmessage + "');</script>"; // ...

How to disable cache in asp.net? -

i'm working on e-commerce website using vb.net. user login buy of products , can see order details. once logged in, session user id created , logged out, sesssion abandoned. i logged in site, copy 1 of link(e.g. order details) , logged out. when run link, page stil displayed eventhoug session abandoned. if refresh page, page login page. this haapends of browser. have tested ie, same version of ie 8, of them cashed page, o. how can disable cached page? in addition ending session upon logout telling .net authentication end? when using forms authentication, example, need formsauthentication.signout();

ajax - webserivce is called from my jquery -

i have created code access method addnums in webservice. sending data through webservice output. not giving output. <html xmlns="http://www.w3.org/1999/xhtml"> <script src="scripts/jquery%20v1.6.4.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { $("#btn").click(function () { alert('i have been clicked'); $.ajax({ type: "post", url: "http://localhost:5554/service1.svc", data: "{2,3}", contenttype: "application/json; charset=utf-8", datatype: "json", success: function (msg) { $("#output").text(msg.d); } }); }); }); </script> <head runat="server"> <title></title> </head> <body...

c# - Most efficient way to write large files to HttpResponse in ASP.NET -

i creating zip file on fly. using dotnetzip doing this. size of zip file can go 500 mb, many users trying download @ same time. what efficient way in can serve files? if given choice, rather not save files on disk either, since might cause severe disk space constraints. edit:more use case: we hosting our files in sharepoint 2010 asset library hosted in intranet site has users around world. files typically range 10-80 mbs. users ability download multiple files @ once. well, in theory : for traditional asp.net application should able write response data (bytes) httpcontext.response.outputstream (how http response context depend on how handle download request e.g. if implementing ihttphandler http context passed you). looking @ dotnetzip examples looks save method takes stream, simple as zip.save(context.response.outputstream); if zip file re-used , downloaded many users can instead write zip memorystream when creating zip allows later copy contents of memo...

c# - Cannot implicitly convert type 'System.Collections.Generic.List<Library.Product>' to 'System.Collections.Generic.List<Library.IHierarchicalEntity>' -

possible duplicate: in c#, why can't list<string> object stored in list<object> variable i having following code. public class manufacturer : ihierarchicalentity { public string manufacturername { { return _manfuacturername; } set { _manfuacturername = value; } } private string _manfuacturername; public list<product> products { { return _products; } } private list<product> _products; #region ihierarchicalentity members public list<ihierarchicalentity> children { { return products; //this compiler error } } #endregion } public class product : ihierarchicalentity{} public interface ihierarchicalentity { lis...

c# - How to check Authentication Mode value in Web.Config without referencing System.Web -

i have class needs check authentication mode web.config. ex: <authentication mode="forms" /> or <authentication mode="windows" /> now, know can done pretty following code: authenticationsection sec = configurationmanager.getsection("system.web/authentication"); if (sec.mode == "windows") { ... } my problem is, class/project being referenced in web project, winforms project. winforms project requiring .net 4.0 client profile framework (we don't want require full .net 4 framework, if possible). if i'm not mistaken, client profile not contain system.web.dll. is there way value can checked without referencing system.web (and preferably without manually parsing config file)? i've tried: object authsection = configurationmanager.getsection("system.web/authentication"); if (authsection.tostring() == "windows") { ... } however tostring() returns string "system.web.configuration....

perl - Mocking up Apache session data for unit testing -

i'm working web application that, normally, runs in mod_perl under apache. co-worker , trying unit testing. there tools or techniques out there mocking-up sessions , requests , exercise code outside of web server context? if you're using mod_perl 1, there apache::fakerequest comes mod_perl. not complete mock of request object, have add methods of own. more if code uses apache::request . yet more cookies , uploads. you're going spending lot of time test::mockobject . fortunately, apache object interfaces pretty straight forward. if @ possible, should consider switching plack based framework (catalyst, dancer , etc...) provide far more robust testing , debugging facilities. if you're using mod_perl2, you're in luck! it's easy (relative mod_perl 1) wrap mod_perl2 application plack. plack::app::fakeapache of work you. here discussion sketching out various techniques , benefits.

c++ - Trying to define a function, but I get "variable or field `function_A' declared void" -

#include <cstdio> #include <cstdlib> #include <iostream> using namespace std; class student; void function_a(student& s) class student { void function_b() { ::function_a(*this); } int courses; }; void function_a(student& s) { // line 18 (where error occurring) s.courses = 1; } int main() { student s; s.function_b(); return 0; } the error getting follows: (line 18) new types may not defined in return type. part of problem you're using type student before it's defined making parameter function_a . make work need add forward declaration function_a switch function_a take pointer or reference move function_a after student . necessary member courses defined before it's accessed add ; after end of class student definition try following class student; void function_a(student& s); class student { // of student code }; void function_a(student& s) { s.courses = 1;...

c++builder - How to open HTMLHelp (.chm) file from Borland C++ Application -

we have legacy application developed in borland c++ builder. have updated file htmlhelp (.chm) file, want click on button in legacy c++ application open .chm file. seems cannot find way this? can help? my application uses html in newer version of c++ builder. here code snipit of how include in main form. //helpviewer #include "htmlhelpviewer.hpp" #pragma link "htmlhelpviewer" in formactivate application->helpfile = "some drive letter:\\some directory\\somehelpfile.chm"; to display help application->helpcommand(help_contents,0); hope of value

objective c - Create NSDate from Unix timestamp -

how create nsdate unix timestamp? channel.startdate = [nsdate datewithtimeintervalsince1970: (nstimeinterval)[channeljson objectforkey:@"broadcaststartedtime"]]; i error: 104: error: pointer value used floating point value expected channels.startdate nsdate* . value key "broadcaststartedtime" javascript number converted nsnumber or nsdecimalnumber sbjson parser library. try instead: nsnumber *starttime = channeljson[@"broadcaststartedtime"]; channel.startdate = [nsdate datewithtimeintervalsince1970:[starttime doublevalue]]; your value trapped in pointer type of nsnumber . datewithtimeintervalsince1970 method expecting primitive nstimeinterval (which, under covers, double ).

c# - Writing to a file and formatting rows .Suggestion needed -

wondering if better suggestions have come with. i have requirement write text file in particular format each field must start @ position stated , must padded blank spaces till next one. example: field position in row name 1 surname 20 address 50 country 90 dob 120 maritalstatus 160 below prototype attempt, there neater better way of doing this? need test position in row correct in unit test? any suggestions? class program { static void main(string[] args) { customer customer=new customer(); customer.name = "jo"; customer.surname = "bloggs"; customer.address = " 1 newyork road"; customer.country = "uk"; ...

Ruby TextHelper highlight method with Regexp -

i'm trying highlight every digit sequence in text using highlight method. can achieve passing array of numbers, way each number highlighted individually. i'd highlight whole sequence. is possible use highlight regexp? i'm receiving following error: highlight(text,/\d+/) can't convert regexp string thanks unfortunately not! can use source of highlight method inspiration write own helper need. def highlight_digits(text) # based on actionview::helpers::texthelper#highlight highlighter = '<strong class="highlight">\1</strong>' matcher = /(\d+)(?!(?:[^<]*?)(?:["'])[^<>]*>)/ text.gsub(matcher, highlighter).html_safe end if feel comfortable, can propose patch rails include feature!

javascript - facebook app iframe login issue on safari -

i have facebook app uses iframe. facebook loads website inside iframe. when click link, website display iframe using lightbox display facebook login. works fine on ff, ie, chrome. on safari, frame keeps reloading infinitely. php code $me = null; $session = $facebook->getsession(); if ($session) { try { $me = $facebook->api('/me'); $_session['facebook'] = $me; } catch (facebookapiexception $e) { } } if($me) require_once("logged.php"); else require_once("login.php"); javascript in login.php window.fbasyncinit = function() { fb.init({ appid : '<?=$appid?>', status : true, // check login status cookie : true, // enable cookies allow server access session xfbml : true // parse xfbml }); check_login_session(); // whenever user logs in, refresh page fb.event.subscribe('auth.login', function() { $.browser.safari = ( $.browser.safari &&...

build - GWT - including source files outside module's package hierarchy -

i have gwt project in eclipse following structure gwt module com.foo.gwt -> dashboard.gwt.xml com.foo.gwt.client com.foo.gwt.server i have different packages com.bar.baz1 , com.bar.baz2 , etc. contents want include in client side code. files gwt java->js conversion compatible. the problem <source> tag in dashboard.gwt.xml, treats path relative directory of dashboard.gwt.xml . cannot reference outside com.foo.gwt hierarchy. so created new module mynewmodule.gwt.xml in com.bar , included baz1 , baz2 sub packages using relative paths in tag. made dashboard.gwt.xml inherit new module. this works fine when compile dashboard module fails when compile mynewmodule. that's because classes in mynewmodule reference classes of dashboard module. i tried inheriting dashboard module in mynewmodule. creates circular reference, gwt doesn't complain it. works not comfortable circular reference. don't need mynewmodule, need way include code packages outside ...

java - Grails, Spring Security LDAP Plugin -

i'm trying ldap plugin work. want ldap authentication against active directory seems i'm missing something. config grails { plugins { springsecurity { userlookup.userdomainclassname = 'de.ac.dmf.security.user' userlookup.authorityjoinclassname = 'de.ac.dmf.security.userrole' authority.classname = 'de.ac.dmf.security.role' ldap { context.managerdn = 'cn=dmf systemuser,cn=users,dc=dmf,dc=local' context.managerpassword = 'password1' context.server = 'ldap://192.168.100.133:389/' authorities{ groupsearchbase ='ou=groups' groupsearchfilter = '(member={0})' retrievegrouproles = false retrievedatabaseroles = false defaultrole = 'user' ignorepartialresultexception ...

Is JAVA 1.7 stable or still beta version? -

i want switch java 1.6 1.5 think it's better go 1.7 instead of 1.6. 1.7 stable or still in beta? by moment working 1.6 , still no plans migrate. recommend not going last version. think isn't stable yet.

ruby - Arrays misbehaving -

here's code: # = array.new(3, array.new(3)) = [[nil,nil,nil],[nil,nil,nil]] a[0][0] = 1 a.each {|line| p line} with output: [1, nil, nil] [nil, nil, nil] but using commented line: [1, nil, nil] [1, nil, nil] [1, nil, nil] so why that? the commented line assigning 3 of same reference array, change 1 array propagate across other references it. as 2 arrays vs 3, that's matter of first line specifying 3 first parameter , specifying 2 array literals in second line. to create nested arrays without having shared references: a = array.new(3) {array.new(3)} when passed block ( {...} or do ... end ), array.new call block obtain value of each element of array.

javascript - Backbone Collection fetching throwing id error -

i'm trying figure out backbone.js , going through peepecode backbone.js basics video. when try , fetch collection in chrome's javascript console, throws following error: uncaught typeerror: cannot use 'in' operator search 'id' in [{ here json: [{ "id" : "1", "title": "bound - zen bound ingame music", "artist": "ghost monkey" }, { "id": "2", "title": "where earth meets sky", "artist": "tom heasley" }] here collection code: window.albums = backbone.collection.extend({ model : album, url: '/services/albumsservice' }); any ideas? not sure why happening. have id field in json..so i'm puzzled. help! your model album visible collection? , inherits backbone.model.extend?

android - RadioButton select not working -

Image
hi there, have 4 radio buttons in 2 different radiogroup , need usual 1 per group can selected, doesn't work, suggestions? <?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scrollview1" android:layout_width="match_parent" android:layout_height="match_parent"> <tablelayout android:background="#ffffff" android:layout_width="match_parent" android:layout_height="match_parent" android:stretchcolumns="1"> <radiogroup android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:id="@+id/radgroupdep"> <tablerow> <radiobutton android:id="@+id/raddepair" android:layout...

asp.net - Facebook Connect OAuth Window Popup -

when pop fb connect oauth login window, how have direct new page once user has signed in? right now, it's redirecting same page. you use redirect_uri parameter, passing url. this pretty covers all

c# - Generics problem -

i'm making class can cheat @ minesweeper, , building generics... i'm kinda stuck. want return int how convert it? public t readmemory<t>(uint adr) { if( address != int.minvalue ) if( typeof(t) == typeof(int) ) return convert.changetype(memoryreader.readint(adr), typeof(t)); else messagebox.show("unknown read type"); } you need cast return value call changetype return (t)convert.changetype(memoryreader.readint(adr), typeof(t));

bash - PHP: How to get the error message of failed shell command? -

i execute following command make database backup: $exec = exec("mysqldump --opt --user=$database_user --password=$database_pass --host=$database_host $database_name > $output_filename", $out, $status); to check if mysqldump failed do: if ($status == 0) { // ok } else { // error // how print error message here ? } in case goes wrong , mysqldump fails, how error message ? you can use proc_open (as suggested emil). below more complete example of how achieve want. $exec_command = "mysqldump --opt --user=$database_user --password=$database_pass --host=$database_host $database_name" $descriptorspec = array( 0 => array("pipe", "r"), // stdin pipe 1 => array("file", $outpu...

Compile Imagemagick for Android using NDK -

i'm new in android, have question ask. want use imagemagick library edit images in android don't wanna use jmagick interface. has import imagemagick on android before? if so, can please give me hints on how this? i have ported android, , code in github .

physics - Corona SDK and moving objects -

i have shapes (rectangle) in game , want implement - when shape object pressed small amount of time , pushed in direction should move small distance pressing shape longer time should moved large distance ( means depending on pressure put on shape , when thrown should move distance relative pressure applied. regards you can break problem 2 pieces: while object being pressed, accelerates (so longer pressed greater speed gets to). as travels, decelerates @ constant rate (so faster it's going @ beginning, longer keeps moving, , farther moves before stops). now have implement velocity , accelaration, pressure , drag. if approach doesn't give appearance want, there ways modify it.

source code protection - Compile PHP to prevent "theft"? -

if create application in java compile , it's hard steal code if send application. know can reverse engineering , such anyways. if create application in php , put on clients server client copy paste code if or wanted. so question is. there convenient way compile or somehow protect php code others if runs on servers? you use ioncube encode files if can afford it. on other hand, use apc cache bytecode , set apc variable apc.stat 0 , remove php files server. way apc in cache without verifying actual php files have changed. you use hiphop compile code, it's tricky set , more doesn't compile without errors.

linux - grep based on blacklist -- without procedural code? -

it's well-known task, simple describe: given text file foo.txt, , blacklist file of exclusion strings, 1 per line, produce foo_filtered.txt has lines of foo.txt not contain exclusion string. a common application filtering compiler warnings build log, ignore warnings on files not yours. file foo.txt warnings file (itself filtered build log), , blacklist file excluded_filenames.txt file names, 1 per line. i know how it's done in procedural languages perl or awk, , i've done combinations of linux commands such cut, comm, , sort. but feel should close xargs, , can't see last step. i know if excluded_filenames.txt has 1 file name in it, then grep -v foo.txt `cat excluded_filenames.txt` will it. and know can filenames 1 per line xargs -l1 -a excluded_filenames.txt so how combine 2 single solution, without explicit loops in procedural language? looking simple , elegant solution. you should use -f option (or can use fgrep same): grep -vf e...

Zsh `which rvm` or `which gem` returns the function contents instead of the path -

i've never had problem before other machines reason in zsh whenever type which gem or which rvm i function contents: gem () { local result command gem "$@" result="$?" hash -r return $result } instead of it's path. life of me can not figure out why happening. if switch on bash not have these problems. this normal behavior zsh. which built-in equivalent whence -c , shows definitions of functions. use whence , possibly combination of options not include -f or -c , if don't want this. example whence -w gem display gem: function . if want search external executables (and not aliases, built-ins, reserved words or functions), use whence -v .

How use QueryOver on NHibernate to select custom result -

i have code return colors have text: public ienumerable<color> findstartingwith(string term) { return session.queryover<color>().where(color => color.name.islike(text, matchmode.anywhere)).list(); } but want do, return string ienumerable containing list of color.name... how can queryover? thanks junio syntax may not right should somethign like: public ienumerable<string> findstartingwith(string term) { return session.queryover<color>() .select(color => color.name) .where(color => color.name.islike(text, matchmode.anywhere)) .list<string>(); }

oop - Constructor Overloading in PHP -

problem approch i have class overloaded constructors code <?php /* users abstract class */ abstract class user { protected $user_email; protected $user_username; protected $user_password; protected $registred_date; //default constructor function user() { } //overloded constructor function user($input_username,$input_email,$input_password) { __set($this->user_username,$input_username); __set($this->user_email,$user_password); __set($this->user_password,$input_password); } } ?> problem details above code provides error : error:fatal error: cannot redeclare user::user() as other languages such c++ , java uses above approach overload constructors how in php oop ? additional information im using * php 5.3.2 in lamp * oop concepts should supported in version php doesn't have overloading. has series of magic methods described overloading in manual (see: http://php.net/m...

Perl complaining about uninitialized value in regex -

i have function below: sub getminfromparam { ($param) = @_; print "pppp = $param\n"; $min; if ($param =~ /\s*\[(\s+),\s*(\s+)\]\s*/) { print "in here\n"; $min = $1; } elsif ($min =~ /((\w+),)+/) { @tmp = split (/\s*,\s*/, $param); if ($tmp[0] =~ /\[(\w+),\s?(\w+)\]/) { $min = $1; } else { $min = $tmp[0]; } } return ($min); } when $param string like: 120u, 421u, 53, 19, 41u, 53, error: use of uninitialized value in pattern match (m//) @ line: if ($param =~ /\s*\[(\s+),\s*(\s+)\]\s*/) { why complaining uninitialized value when $param defined? it's not. it's complaining line: elsif ($min =~ /((\w+),)+/) { at least here test data 120u, 421u, 53, 19, 41u, 53 which expected, since $min set if $param matches, elsif runs if $param doesn't match. that line supposed elsif ($param =~ /((\w+),)+/) { , in case don't warnin...

dwr - Can someone explain the Spring web.xml file? -

i'm new java enterprise , spring have strong grasp of standard java. looking through existing web application project. project uses tomcat/spring/hibernate understand common. uses dwr remote method invocations. i'm finding difficult separate responsibilities: tomcat responsible for, spring responsible for, how request gets 1 other, , how major pieces of spring fit together. i've read great deal of documentation on spring, particularly beans , bean factory , still in process of reading more. advice guys have welcome, i'll provide specific questions. question 1: web.xml fit things (when used/called, , called from)? code sample 1: <servlet> <servlet-name>qrst</servlet-name> <display-name>qrst servlet</display-name> <servlet-class> org.springframework.web.servlet.dispatcherservlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> what above snippet (or,...

url rewriting - change url address using Javascript -

possible duplicate: how rewrite url without refresh, github.com let have variable in javascript var currentpage = 0; my address page address www.xyz.com/page/1 when click somewhere , js function trigger currentpage = 1 //here want change/rewrite www.xyz.com/page/2 //without redirecting page see pushstate (browser support limited).

view HTML portion of php file in mac chrome? -

so i'm working on html in php page, , want view styling/html in web browser. on windows machine, when drag php file chrome window, render html portions. on mac, if this, attempt save php file. how configure renders html instead of trying save it? sounds me mac doesn't have apache turned on? or possibly php isn't enabled if do? easiest way activate php , mysql on mac os 10.6 (snow leopard), 10.7 (lion), 10.8 (mountain lion)?

iphone - NSTimer getting zombie -

i have created nstimer in application gets fired after every 1 min interval. problem when put application in background , after time 5 min, bring in foreground, timer object gets zombied. any thoughts on this. perhaps invalidate timer when application enters background start again when application enters foreground. like so: - (void)applicationdidenterbackground:(uiapplication *)application { [mytimer invalidate]; } - (void)applicationwillenterforeground:(uiapplication *)application { mytimer = [nstimer scheduledtimerwithtimeinterval:60.0 target:self selector:@selector(timerfunction) userinfo:nil repeats:yes]; }

php - MPDF No Output (Blank Page) -

i'd installed mpdf utility in order convert html&css pdf reports. far things have been working fine, until i've tried converting page pdf ,and there's no output. i have mention i'm able display page regularly through browser - problem comes when i'm trying convert pdf - receive blank page. moreover, there no encoding problems (part of output written in hebrew, i've overcame obstacle) here's part of code : if($customer!=$tempcustomer) { if($tempcustomer!="") { $html.=("</table>"); $html.=("</br>סהכ".$sumtotal."</br>"); $html.=("</br>משטחים".$sumpallets."</br>"); } $sumtotal=0; //reset sum of each customer $sumpallets=0; //reset pallets count $html.=("</div>"); $html.=("<div class='subtable'>"); // $html.=("לקוח: ".$customername."</br>"); $sumtota...

scheduled tasks - How to properly quote file path with SCHTASKS -

i'm writing small app generates contents of batch file, using schtasks create scheduled tasks. however, cannot file path working correctly. need set of eyes. schtasks /create /tn "task1" /tr "\"c:\program_files\spybot - search & destroy\spybotsd.exe\" \autocheck \autofix \autoclose" /st 01:00:00 /sc daily /ru myuser /rp mypass i've looked @ other threads here, , ms documentation, , think have formed correctly. however, fails output: error: invalid syntax. mandatory option '/sc' missing. type "schtasks /create /?" usage. system cannot find path specified. i use advice here. you need escape ampersand caret this: schtasks /create /tn "task1" /tr "\"c:\program_files\spybot - search ^& destroy\spybotsd.exe\" \autocheck \autofix \autoclose" /st 01:00:00 /sc daily /ru myuser /rp mypass

Android - multiple EditText fields in window resize -

in 1 of views, have 3 edittext fields. first 2 single line, , third multline. i'm using android:windowsoftinputmode="statevisible|adjustresize" third field collapses far small in portrait mode when ime comes , has focus. is there option set minimum height force window scroll down accommodate third field? i have tried setting android:minheight="20dip" in xml file, has no effect. the edittext in question looks like: <edittext android:id="@+id/msgreplyarea" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="top" android:layout_weight="1" android:layout_marginleft="10dip" android:layout_marginright="10dip" android:layout_margintop="10px" android:inputtype="textcapsentences|textmultiline" android:imeoptions="flagnoenteraction" /> thanks. ...

Set environment variable with having space linux -

i want set environment variable has space in it. path folder , folder name is: /home/mehrabib/my video i edit .bashrc , add following line it: export $video=/home/mehrabib/my\ video and run these commands: echo $video cd $video the result is: /home/mehrabib/my video /home/mehrabib/my :no such file or directory i change to export $video=/home/mehrabib/my\\\ video and run these commands: echo $video cd $video the result is: /home/mehrabib/my\ video /home/mehrabib/my\ :no such file or directory what should do? you should export video="/home/mehrabib/my video" and sum dan's comments do cd "$video" which expand to cd "/home/mehrabib/my video" again. personally, i've come prefer ${video} syntax.

What are jQuery's most important challenges, and what as a developer can I do about them? -

i have project coming build interface allows user construct content pre-defined templates , code snippets. we've decided use jquery , jquery ui frameworks dragging/dropping/sorting parts. there needs edit-in-place, , i'm going use contenteditable combined jquery's css functions. i have quite bit of experience both frameworks (and love them), typical project far has run 50 lines whereas 1 run lot more that, using more of functions , writing own plugins. before start work on project i'm wondering if there common pitfalls jquery - kind of 'jquery - bad parts'. there functions best avoided? there functions need working around? i read this link it's 2 years old , lot has changed in jquery (and browsers) since then. any 'use framework instead' or 'don't use framework' answers ignored - have use jquery. 'jquery rubbish' rants don't provide solutions ignored. constructive comments please. if knew how better in javascr...

javascript - Issues with offsetTop when HTML margin is applied -

if set css html { margin: 10px; border 10px solid #ccc; padding: 10px; } and try offsettop of element, possible convince browsers (ie , ch) not ignore document margin in calculation? firefox works expected reporting values according rendered html (uses 3 values). is there fast cross-browser way of calculating offsettop when offsetparent body . unfortunately jquery's .offset() doesn't trick here :( this code thinking , started. the idea use htmlelement.getboundingclientrect() function that's supported major browser these days (and has been quite time now). difference i've found out when running against document.documentelement element. ff , chrome don't report bottom values according view port rather whole document itself. so careful.

ruby on rails - In RVM, gem list command does not show installed gems -

in rails application ruby -v ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux] when run rvm gemset list it specifies gemset i'm using global => blackapp now bundle install , gems installed successfully.when gem list, shows * local gems * empty.when run rvm gem list shows gems.so reason gem list not working. i think used bundle pack , reason shows . bundle complete! installed ./vendor/bundle how overcome this? bundle install install gems vendor/cache directory within rails app, not install them in gems directory. list gems installed bundler, use bundle list

html - How to have input field already have the 'clicked on' look without having to click it? -

i want input field have clicked on when @ input field '|' flashing without having having clicked on it? it gives search field more welcoming touch here html field: <input type="text" name="search" size="36" value="" style="background-color:white;border: solid 1px #ffffff; height: 30px; font-size:19px; font-family: helveticaneue-light; font-weight: 1; vertical-align:9px;color:#bbb" onfocus="if(this.value == ''){this.value = '';this.style.color='#363d42'}" /> thanks! james if intent have actually focused well, in javascript: add id input node: id="myid" <script type="text/javascript"> document.getelementbyid("myid").focus(); </script> also, html 5 has autofocus attribute: <input type="text" autofocus="autofocus" />

powershell - How to execute script block on remote machine that uses local variable as an argument -

i run application passing arguments remote machine. i've got following work on remote machine running locally: foreach ($a in $args){ &"c:\program files\christiansteven\crd\crd.exe" "-s schedulename=vc_$($a)" } i'm having problems running remotely using: foreach ($a in $args){ invoke-command -computername $serv -credential $cred -scriptblock {param($b) &"c:\program files\christiansteven\crd\crd.exe" $b} -argumentlist "-s schedulename=vc_$($a)" } from i've read variables scope , remedy create scriptblock before pass remote machine using: [scriptblock]::create(<command>) i've tried many combinations , can't run. you can this: $scriptblock = {param($a) &"c:\program files\christiansteven\crd\crd.exe" "-s schedulename=vc_$($a)"} foreach ($a in $args){ invoke-command -computername $serv -credential $cred -scriptblock $scriptblock -argumentlist $a ...

javascript - How would I sanitize this string? (perferably in JQuery)? -

i have webpage people type stuff text box, , displays text below them. that's it. there no server side. let's types <script src="blah">hello</script> i want display text. not script, of course. how can (all in javascript)? i want display entire text. don't stip tags out. $('div.whatever').text($('input.whatever').val()); that'll convert things html entities, they're displayed typed, , not treated markup.

android - A way to mock satalites data (count, SNRs) -

locationmanager.addtestprovider() gives easy way mock location. however, in case, locationmanager.getgpsstatus() still returns empty data , can cause software think there no gps signal. there way control data returned getgpsstatus()? create adapter around locationmanager. have api adapt, aka work way want. easier mock plus can control return each time.

jquery - Latest tweet from multiple users on same page? -

is there way display latest tweets 4 users on same page? i'm using code sea of clouds display latest tweet 1 user , works excellently. i'm wondering if maybe can tweak somehow display latest tweet more 1 user. have @ line source: jquery.tweet.js, line 129. var query = (s.query || 'from:'+s.username.join(' or from:')); it seems s.username array , can populate multiple user names i.e. s.username = [user1, user2, user3] etc. leave query falsy if this. luck :)

jquery - Resize div onclick of another div, transition effect -

hey guys. have 2 divs. when click .menu (the grey bar), .sort (the orange bar) resizes in height. i've done using jquery. problem is, without nice transitions. doesn't slide, doesn't fade..nothing. pops down. here's jsfiddle of mean. http://jsfiddle.net/khcvr/ can possibly me slides down rather pops? jquery knowledge super limited. cheers. your demo using mootools though question tagged jquery. cleaned demo bit. demo here : http://jsfiddle.net/jomanlk/khcvr/1/ code here $(".menu").click(function() { $(".sort").animate({"height" : "350"}, 500); });

iphone - NSURLRequest: How to change httpMethod "GET" to "POST" -

get method, works fine. url: http://myurl.com/test.html?query=id=123&name=kkk i not have concepts of post method. please me. how can chagne method post method? url: http://testurl.com/test.html [urlrequest sethttpmethod:@"post"]; try nsstring *post = [nsstring stringwithformat:@"username=%@&password=%@",username.text,password.text]; nslog(@"%@",post); nsdata *postdata = [post datausingencoding:nsasciistringencoding allowlossyconversion:yes]; nsstring *postlength = [nsstring stringwithformat:@"%d",[postdata length]]; nsmutableurlrequest *request = [[[nsmutableurlrequest alloc] init] autorelease]; [request seturl:[nsurl urlwithstring:[nsstring stringwithformat:@" server link here"]]]; [request sethttpmethod:@"post"]; nsstring *json = @"{}"; nsmutabledata *body = [[nsmutabledata alloc] init]; [request setvalue:postlength forhttpheaderfield:@"content-length"]; [request setv...

android - How To Display Border To Imageview? -

Image
friends how display border imageview ? i want result mobile gallery image display border. plz give me ans advance.... you can create resource (layer drawable xml) imageview 's "border" (actually background), , declare in theme imageview 's background resource drawable xml. if need "border" changed based on imageview 's state ( focused , selected , etc.), should create more layer drawables, , put them selector xml (state drawable). in theme should set imageview 's background selector.xml . update below sample of how specify simple border images, result in you have create new layer drawable file ( image_border.xml ), modify/create styles.xml file modify/create colors.xml file modify layout xml file (or code) apply style imageview . res/drawable/image_border.xml <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> ...

html - Changing innerHTML in javascript removes link -

i have block of text want keep hidden until user asks view it. html: <a href="javascript:toggledisplay('01');"> <div id="title01"> show details </div> </a> <div id="hide01" class="details"> description: </div> now, block hiding , showing works fine, when change innerhtml on div title01 , no longer remains link. here's js: var div = document.getelementbyid('hide'+div_id); var title = document.getelementbyid('title'+div_id); if (div.style.display === 'block') { div.style.display = 'none'; } else { div.style.display = 'block'; title.innerhtml = 'hide'; } since changing innerhtml on div id title01 only, fail understand why doesn't remain link. , can fix that? use jquery text function change content $('#title01...

c# - How to modify Stored Procedure or ASP.net Code to get autogenerated Id after inserting new row -

i m creating new user registration moduleand wrote following stored proc. procedure [dbo].[addnewuser] -- add parameters stored procedure here @usertype varchar(10), @useremail varchar(70), @userpass varchar(20), @fullname varchar(70), @city varchar(70), @state int, @allowalerts bit, @allowletter bit, @aboutme nvarchar(160) begin -- set nocount on added prevent result sets -- interfering select statements. set nocount on; if ((select count(user_info._id) user_info useremail @useremail) = 0) begin insert user_info (usertype,useremail,userpass,fullname,city,[state],allowalerts,allowletters,aboutme) values ( @usertype, @useremail, @userpass , @fullname, @city, @state, @allowalerts, @allowletter, @aboutme ) select @@identi...

c - Given centers, find minimum radius for set of circles such that they fully cover another -

i have following geometry problem: given circle center in origin - c(0, 0), , radius 1. inside circle given n points represent centers of n different circles. asked find minimum radius of small circles (the radius of circles equal) in order cover boundary of large circle. the number of circles is: 3 ≤ n ≤ 10000 , problem has solved precision of p decimals 1 ≤ p ≤ 6. for example: n = 3 , p = 4 and coordinates: (0.193, 0.722) (-0.158, -0.438) (-0.068, 0.00) the radius of small circles is: 1.0686. i have following idea problem implementing it. idea consists of binary search find radius , each value given binary search try , find intersection point between small circles , large one. each intersection have result arc. next step 'project' coordinates of arcs on x axis , y axis, result being number of intervals. if reunions of intervals x , y axis have result interval [-1, 1] on each axis, means circle covered. in order avoid precision problems thought of searchin...

php - How can I read a Facebook fan page with the Graph API? -

a few more specifics: we have amount of fans on restaurant's page, we'd run our own website well, same content (specials, etc.,) facebook. with said, we'd continue posting our daily specials on facebook, 3,000 people see posts , bring in amount of business there. i have small php script i've written can pull posts off of wall, verify wrote them , small #hashtag verify want posted on main page of our website. however, periodically access token expires and, therefore, suspect i'm not going correctly. does have good, reliable way read posts facebook fan page? thank you! you can try changing access token expiry time offline_access permission. facebook permissions page mentions offline_access; enables application perform authorized requests on behalf of user @ time. default, access tokens expire after short time period ensure applications make requests on behalf of user when actively using application. permission makes access token returned o...

java - Please suggest a platform to port C# app to Mac? -

greetings, i need port windows utility: http://solinker.com mac. app written in c#, .net 2.0. the main requirement is: app should able talk applescript interact photoshop. program small , ui simple consider rewritte app. possible candidates are: monomac unity 3d (seems doesn't required install mono) xulrunner (flickr uploader written xulr) qt java (convert app java + 2 different connector photoshop: mac , win) i appreciate advice! if check documentation monomac, see have packager bundles dependencies final app. so, no need seperate mono install: http://www.mono-project.com/monomacpackager as applescript, monodevelop wrapping of applescript. should take @ source: https://github.com/mono/monodevelop/blob/master/main/src/addins/macplatform/macinterop/applescript.cs i monomac best approach.

amazon ec2 - getting started with EC2 for compute-intensive (non-web) parallel application -

i'm using libsvm regression analysis. works champ. 3-parameter grid search optimize parameters model maxes out 4 cores on 2.66 ghz intel box, , still have wait couple of hours generate single model. this seems job amazon ec2. i've seen plenty of tutorials , introductory material on using ec2 web-related tasks. but if have small compute-intensive custom ansi-c program want run multiple instances of on ec2? can provide pointers on how (or buzzwords search for)? i don't think quest different of web application. stack different of course, regardless – the principles remain same. as commented on question: elastic map reduce might you're looking parallelize work easily, etc.. if limited, cloudera . ready-to-rumble hadoop distribution support ec2 well . if map-reduce not liking, need setup own instance. speaking, keypoints follows: you want figure out way start ec2 instances. you want figure out way bootstrap , configure them. cluster/network?...

C - Setting a static char array with a "string" -

a simple question afraid have been stuck days this, google gives me nothing, tried bing... ;o) i working in pure c under windows in vs2010. i have static char array such... static char word[5]; i can set each array position fine i.e... word[0] = 'f'; word[1] = 'o'; word[2] = 'o'; but cannot seem (at point after declaration) is... word = "foo"; any or pointers going wrong appreciated. thanks in advance. strncpy(word, "foo", _countof(foo)); if _countof not defined, use sizeof(foo) / sizeof(*foo) instead.

Send input to running shell script from bash -

i'm writing test suite app , using bash script check test suite output matches expected output. here section of script: for filename in test/*.bcs ; ./bcsc $filename > /dev/null number=`echo "$filename" | awk -f"[./]" '{print $2}'` gcc -g -m32 -mstackrealign runtime.c $filename.s -o test/e$number # run file , diff against expected output echo "running test file... "$filename test/e$number > test/e$number.out if [ $number = "4" ] # it's trying read line # pass input file... fi diff test/e$number.out test/o$number.out done test #4 tests reading input stdin. i'd test script #4, , if pass set of sample inputs. i realized test/e4 < test/e4.in > test/e4.out where e4.in has sample inputs. there way pass input running script? if want supply input data directly in script, use here-document: test/e$number > test/e$number.out if [ $n...

jquery and javascript's closure -

i having code below , javascript's closure anonymous functions giving me headache. for (var = 0, len = sites.length ; < len ; i++) { $("#thumb"+i).click(function() { $("#shader").show(); $("#thumbinfo"+i).show(); alert("#thumbinfo"+i); }); $("#thumbinfo"+i+" .xbutton").click(function() { $("#shader").hide(); $("#thumbinfo"+i).hide(); }); } due closure, 5 (the sites array has 5 elements), click handlers refer same id. any workaround? you loop jquery's each() . $.each(sites, function(i) { $("#thumb"+i).click(function() { $("#shader").show(); $("#thumbinfo"+i).show(); alert("#thumbinfo"+i); }); $("#thumbinfo"+i+" .xbutton").click(function() { $("#shader").hide(); $("#thumbinfo"+i).hide(); }); });