Sunday, 15 July 2012

ios - Transfer Multiple Images via NSInputStream/NSOutputStream -



ios - Transfer Multiple Images via NSInputStream/NSOutputStream -

i have 2 nsinputstream , nsoutputstream connected each other via network. want transfer core info objects , associated images 1 device other device. have converted core info objects json , transferred other side of stream , populated core info json. there images associated each recorded. images on disc, there path stored in core info objects. now, have have finish info @ hand when writing output stream. have xml (that contains json) ready. 1. how transfer images (nsdata *) along xml (also nsdata *) ? how differentiate @ reading end (nsinputstream) between xml , images? 2. also, have transfer multiple images, how tell @ nsinputstream end bytes of image have finished , the bytes of next image have started ? 3. how know image (name) has been transferred ? thanks

convert nsdata (of each uiimage) nsstring representation, set nsstring objects nsdictionary , serialize dictionary. in way when transfer info on can reverse process extract images knowing key points image. way should able transfer multiple images.

hope helps.

cheers

ios image nsstream nsinputstream nsoutputstream

ipad - Monotouch Crash: Replace UINavigationController A with B and Push UiViewControllers on B -



ipad - Monotouch Crash: Replace UINavigationController A with B and Push UiViewControllers on B -

we have been using xamarin while , causing weird crash while developing latest ipad app. next problem:

the ipad app uses story board 2 navigation controllers (say , b) each has rootviewcontroller (say a1 , b1), default navcontroller , showed on app start up. there 2 buttons on a1 , pressing button 1 loads navcontroller b.here steps code execute when button 1 on navcontroller clicked.

in button event handler , phone call public function in appdelegate following:

get storyboard id , instantiate navcontroller b using storyboard.instantiateviewcontroller. remove navcontroller superview (using uiview.view.removesuperview()) assign above reference of b appdelegate window's root view controller (which loads rootview controller b1 of navcontroller b).

it works fine till above step (i can see rootviewcontroller's uiview load on ipad).

the next step trying force uiviewcontroller after instantiating it.(because target 2 show sec screen in hierarchy) (storyboard.instantiateviewcontroller(identifier).this should ideally show me pushed view controller.but app crashes after step.!! weird!!!!. next simplified code:

public void setnavcontrollerb(uinavigationcontroller nava, uistoryboard storyboard) { nava.view.removefromsuperview(); this.window.rootviewcontroller = (uinavigationcontroller)storyboard.instantiateviewcontroller("vc0"); // 'vc0' identifier navigationcontroller b rootviewcontroller "vc1" // works great till above step uiviewcontroller vc2 = (uiviewcontroller)storyboard.instantiateviewcontroller("vc2"); ((uinavigationcontroller)this.window.rootviewcontroller).pushviewcontroller(vc2, true); //the above executes out exception, crashes later. }

pleaseeeee help!!!!!!

if modifying stack in uinavigationcontroller beyond force or pop, need replace entire stack of controllers:

mynavcontroller.setviewcontrollers(new uiviewcontroller[] { controller1, controller2 }, true);

if seek force or pop before previous force or pop completes, crash , warning in console output.

ps - don't think should need phone call removefromsuperview anywhere in situation, should modify uinavigationcontroller's stack or replace rootviewcontroller on window.

ipad uinavigationcontroller monotouch uistoryboard

c# - Moq verify that the same method is called with different arguments in specified order -



c# - Moq verify that the same method is called with different arguments in specified order -

here's method need unit test:

void do(ienumerable<string> items, textwriter tw){ foreach(var item in items) { tw.writeline(item); } }

how can configure mock of textwriter verify arguments passed same method (writeline) in order ?

[test] public void test(){ var mock = new mock<textwriter>(); mock.setup( ??? ); //check writeline called 3 times, //with arguments "aa","bb","cc", in order. do(new[]{"aa", "bb", "cc"}, mock); mock.verify(); }

you can utilize callback verify passed parameter each call:

[test] public void test(){ var arguments = new[]{"aa", "bb", "cc"}; var mock = new mock<textwriter>(); int index = 0; mock.setup(tw => tw.writeline(it.isany<string>())) .callback((string s) => assert.that(s, is.equalto(arguments[index++]))); do(arguments, mock.object); mock.verify(); // check arguments passed assert.that(index, is.equalto(arguments.length)); }

c# unit-testing moq

Azure: How do I disable the deployment an just create a package file? -



Azure: How do I disable the deployment an just create a package file? -

we have couple of cloud services , continuous delivery test environment via team build. production environment, have our own deployment powershell script. script needs .cspkg file deployment.

my problem haven't found way allow team build create .cspkg file not publish azure. i've used azurecontinousdeployment.11.xaml template , insists on publishing package. i've tried set "deployment settings name" empty string. build runs without errors, way, no bundle created.

is there way stop somewhere in between? maybe alter in .azurepubxml file accomplish that?

environment: vs2012, team foundation service (visualstudio.com)...

i have custom build template xaml invoke msbuild task (microsoft.teamfoundation.build.workflow.activities.msbuild) on azure project (.ccproj file) "publish" target.

(despite having same name ui command pushes bundle azure, "publish" target means "generate bundle without pushing anywhere".)

deployment azure visual-studio-2012

c# - Linq to SQL - how to make a select with conditions and return IQueryable -



c# - Linq to SQL - how to make a select with conditions and return IQueryable -

i can not find answers how implement next scenario (i not know methods). utilize c#, .net fw4.5, linq sql , design pattern repository.

if want select devices, utilize code:

/// <summary> /// devices /// </summary> /// <returns></returns> public iqueryable<device> getdevices() { homecoming mydatacontext.devices; }

if want select device id, utilize code:

/// <summary> /// device id /// </summary> /// <param name="id"></param> /// <returns></returns> public device getdevice(int id) { homecoming mydatacontext.devices.singleordefault( d => d.intdeviceid == id); }

but how can implement next situation?

select devices, conditions (and homecoming iqueryable<device>)

you can utilize :

public iqueryable<device> getdeviceusingpredicate(expression<func<device,bool>> predicate) { homecoming mydatacontext.devices.where(predicate).asqueryable(); }

to utilize generics:

public iqueryable<t> getdeviceusingpredicate(expression<func<t,bool>> predicate) { homecoming mydatacontext.gettable<t>().where(predicate).asqueryable(); }

c# linq-to-sql repository-pattern

c++ - Wchar_t to string Convertion -



c++ - Wchar_t to string Convertion -

i want convert strfilenotifyinfo[1].filename(wchar_t) string can see filepath. can't create work.

here code:

while(true) { if( readdirectorychangesw( hdir, (lpvoid)&strfilenotifyinfo, sizeof(strfilenotifyinfo), false, file_notify_change_last_write || file_notify_change_creation, &dwbytesreturned, null, null) == 0) { cout << "reading directory change" << endl; } else { cout << ("file modified: ") << strfilenotifyinfo[1].filename << endl; cout << ("loop: ") << ncounter++ << endl; } }

use wcout when working wide character data.

std::wcout << l"file modified: " << strfilenotifyinfo[1].filename << std::endl;

c++ string wchar readdirectorychangesw

android - FragmentStatePagerAdapter doesn't call its fragments -



android - FragmentStatePagerAdapter doesn't call its fragments -

i have fragmentstatepageradapter in fragment pager. within pager have 2 fragments switch between them. happening when first come fragment done correctly, when go , homecoming there 1 time again on base of operations fragment called oncreate, oncreateview , on, on fragments in pager not called anything, getitem on adapter not called , pager view blank. on fragments have setretaininstance(true) needed due rotation behaviour handling. can help me guys that?

android fragment pager

php - Arabic in zend pdf -



php - Arabic in zend pdf -

i new in zend framework. have problem zend pdf. trying create pdf document contains standard arabic english. can't print standard arabic in zend.

please help me tutorials or sample code links.

this still issue in zend_pdf recommend utilize tcpdf here link http://www.tcpdf.org/

go through there examples

http://www.tcpdf.org/examples.php

if still want stick zend pdf may link helpful.

http://devzone.zend.com/1064/zend_pdf-tutorial/

php zend-framework zend-pdf

java - Struts2 ,OPENJPA DAO. Is this a good design for DAO-CRUD? -



java - Struts2 ,OPENJPA DAO. Is this a good design for DAO-CRUD? -

what think of crud design. using openjpa 2.2,struts2. using interface insert delete update. have entity called product. beginner , want know how how guys create or design kind of functionality. if want more info, please it.

my interface.

/* * alter template, take tools | templates * , open template in editor. */ bundle lotmovement.business.crud.crudinterface; /** * * @author god-gavedmework */ public interface crudinterface { public void insert(); public void delete(); public void update(); }

my main crud class.

* * alter template, take tools | templates * , open template in editor. */ bundle lotmovement.business.crud; import java.text.dateformat; import java.text.simpledateformat; import java.util.date; import lotmovement.business.crud.crudinterface.crudinterface; import lotmovement.business.entity.product; /** * * @author god-gavedmework */ public class productcrud implements crudinterface { private date today; entitystart entitystart; product product; public date gettoday() { homecoming today; } public void settoday(date today) { this.today = today; } public entitystart getentitystart() { homecoming entitystart; } public void setentitystart(entitystart entitystart) { this.entitystart = entitystart; } public product getproduct() { homecoming product; } public void setproduct(product product) { this.product = product; } public void insert() { throw new unsupportedoperationexception("not supported yet."); } public void insert(product product) { entitystart.startdbaseconnection(); dateformat dateformat = new simpledateformat("dd-mm-yyyy"); dateformat timeformat = new simpledateformat("hh:mm:ss a"); settoday(new date()); string datetoday = dateformat.format(gettoday()); string timetoday = timeformat.format(gettoday()); // product.setproduct_id(product_id); // product.setserial_number(serial_number); // product.setdate_assembled(date_assembled); // product.setmodel(model); /// product.setbatch_id(batch_id); // product.setprocess_code(process_code); // product.setdc_power_pcb_serial(dc_power_pcb_serial); // product.setcontrol_power_pcb_serial(control_power_pcb_serial); // product.setmains_power_pcb_serial(mains_power_pcb_serial); // product.setblower_serial(blower_serial); // product.setheaterplate_serial(heaterplate_serial); // product.setlast_process(last_process); product.settime_assembled(timetoday); product.setdate_assembled(datetoday); entitystart.startpopulatetransaction(product); entitystart.closedbaseconnection(); } @override public void delete() { throw new unsupportedoperationexception("not supported yet."); } @override public void update() { throw new unsupportedoperationexception("not supported yet."); } }

my openjpa mill class

/* * alter template, take tools | templates * , open template in editor. */ bundle lotmovement.business.crud; import javax.persistence.entitymanager; import javax.persistence.entitymanagerfactory; import javax.persistence.entitytransaction; import javax.persistence.persistence; public class entitystart { public entitymanagerfactory factory; public entitymanager em; public void startdbaseconnection() { mill = persistence.createentitymanagerfactory("lotmovementpu"); em = factory.createentitymanager(); } public void begintransaction(){ entitytransaction usertransaction = em.gettransaction(); usertransaction.begin(); } public void startpopulatetransaction(object entity){ entitytransaction usertransaction = em.gettransaction(); usertransaction.begin(); em.merge(entity); usertransaction.commit(); em.close(); } public void closedbaseconnection(){ factory.close(); } }

java struts2 dao crud openjpa

iphone - iOS Enable Rotation for all Orientations iOS 5 -



iphone - iOS Enable Rotation for all Orientations iOS 5 -

i've written tabbed application few view controllers, , on ios 6 rotates happily in orientations i've got them supported in app summary.

my deployment target ios 5 , i'd able rotate in orientations on too. i've tried varies combinations of:

- (nsuinteger)supportedinterfaceorientations { homecoming uiinterfaceorientationportrait | uiinterfaceorientationlandscape; }

but none enabling rotation ios 5. need set method in app delegate or in view controllers? doing totally wrong??

cheers,

chris

you can add together view controllers

-(bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { homecoming (interfaceorientation == uiinterfaceorientationportrait) || (interfaceorientation == uiinterfaceorientationlandscape); }

or can edit plist's supported interface orientations

iphone ios objective-c xcode ipad

java - struts2 action "*_*" works just like "*" -



java - struts2 action "*_*" works just like "*" -

there 2 actions.and *_* in front end of **(it doesn't matter @ default namespace work after specific namespace(unless specific namespace extends it))

<package name="default" namespace="" extends="struts-default"></package> <package name="admin" namespace="/admin" extends="default"> <global-results> <result>/admin/result.jsp</result> </global-results> <action name="login" class="org.cc.action.adminaction"> <result>/admin/admin.jsp</result> </action> <action name="*_*" class=org.cc.action.{1}action" method="{2}"> </action> </package> <package name="error" namespace="" extends="default"> <action name="**" > <result>/error.jsp</result> </action> </package>

there error page defined catching action doesn't exist

then tested action

localhost:8080/myprojectname/admin/adminaction.action(it doesn't exist)

but caught action named "*_*" because exception showed adminactionaction.class not found.

then used *__*(there 2 '_'). worked , showed error.jsp.

the format "*a*" or "*#*" didn't work either grab action if there no , # in name of action.

the struts version utilize struts 2.3.4.

is there document said between * , * there must @ to the lowest degree 2 characters or *?

and here detail of exception

unable instantiate action, org.cc.action.adminactionaction, defined 'adminaction' in namespace '/admin'org.cc.action.adminactionaction com.opensymphony.xwork2.defaultactioninvocation.createaction(defaultactioninvocation.java:319) com.opensymphony.xwork2.defaultactioninvocation.init(defaultactioninvocation.java:400) com.opensymphony.xwork2.defaultactionproxy.prepare(defaultactionproxy.java:194) org.apache.struts2.impl.strutsactionproxy.prepare(strutsactionproxy.java:63) org.apache.struts2.impl.strutsactionproxyfactory.createactionproxy(strutsactionproxyfactory.java:39) com.opensymphony.xwork2.defaultactionproxyfactory.createactionproxy(defaultactionproxyfactory.java:58) org.apache.struts2.dispatcher.dispatcher.serviceaction(dispatcher.java:501) org.apache.struts2.dispatcher.ng.executeoperations.executeaction(executeoperations.java:77) org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter.dofilter(strutsprepareandexecutefilter.java:91) java.lang.classnotfoundexception: org.cc.action.adminactionaction org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1711) org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1556) com.opensymphony.xwork2.util.classloaderutil.loadclass(classloaderutil.java:152) com.opensymphony.xwork2.objectfactory.getclassinstance(objectfactory.java:108) com.opensymphony.xwork2.objectfactory.buildbean(objectfactory.java:161) com.opensymphony.xwork2.objectfactory.buildbean(objectfactory.java:151) com.opensymphony.xwork2.objectfactory.buildaction(objectfactory.java:121) com.opensymphony.xwork2.defaultactioninvocation.createaction(defaultactioninvocation.java:300) com.opensymphony.xwork2.defaultactioninvocation.init(defaultactioninvocation.java:400) com.opensymphony.xwork2.defaultactionproxy.prepare(defaultactionproxy.java:194) org.apache.struts2.impl.strutsactionproxy.prepare(strutsactionproxy.java:63) org.apache.struts2.impl.strutsactionproxyfactory.createactionproxy(strutsactionproxyfactory.java:39) com.opensymphony.xwork2.defaultactionproxyfactory.createactionproxy(defaultactionproxyfactory.java:58) org.apache.struts2.dispatcher.dispatcher.serviceaction(dispatcher.java:501) org.apache.struts2.dispatcher.ng.executeoperations.executeaction(executeoperations.java:77) org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter.dofilter(strutsprepareandexecutefilter.java:91)

and easy see localhost:8080/myprojectname/admin/adminaction.action(it doesn't exist) caught <action name="*_*" class="net.org.cc.{1}action" method="{2}">

in configuration above mapping created action name adminaction , namespace /admin. that's why you'd gotten exception because action config matchers found action config patten "*_*". can't find pattern "*__*" same action name. fallback default namespace "" , in namespace matches "**" pattern result error page.

actually action name created 2 similar matcher , 1 of them did match. matcher created , pattern used?

the default runtime comfiguration implementation uses parameter loosematch hardcoded true. there's desctiption in javadoc

patterns can optionally matched "loosely". when end of pattern matches *[^*]*$ (wildcard, no wildcard, wildcard), if pattern fails, matched if lastly 2 characters didn't exist. goal back upwards legacy "*!*" syntax, "!*" optional.

and @quaternion mentioned in comment, matcher paterrn * added list. else described earlier.

java struts2 struts url-mapping wildcard-mapping

c# - get every response in Http Get -



c# - get every response in Http Get -

i using webclient , post requests. when send http request get info this:

webclient client = new webclient(); client.downloadstringasync(new uri(requesturi), "get");

i can receive info 1min totally. can receive info in 20 seconds , other in 30 seconds , after completion of 1min. know whenever receive data. have event in web client bytes of info receive.. can 1 please help me find solution.

the webclient.downloadprogresschanged event gets raised whenever 1 of async methods receives data. however, there no way determine info has been read doesn't sound solve problem.

if need total command on request have abandon webclient , work straight lower-level webrequest class. specifically, want send webrequest in order webresponse , phone call getresponsestream on it; returned stream exposes async functionality lets whatever need. downside of course of study have orchestrate manually, going much more 2 lines of code.

there illustration of how on msdn docs webrequest.begingetresponse.

c# .net http webclient

ruby - Why do gems with native extensions fail to build on Ubuntu? -



ruby - Why do gems with native extensions fail to build on Ubuntu? -

i can run bundle install on mac without problem, when run on ubuntu build server fails next output:

gem::installer::extensionbuilderror: error: failed build gem native extension. /var/lib/jenkins/.rvm/rubies/ruby-1.9.3-p385-dev/bin/ruby extconf.rb creating makefile create compiling native.c native.c: in function ‘birch_edge_initialize’: native.c:42:8: warning: unused variable ‘direction’ [-wunused-variable] native.c:41:8: warning: unused variable ‘directed’ [-wunused-variable] native.c:40:8: warning: unused variable ‘node_b’ [-wunused-variable] native.c:39:8: warning: unused variable ‘node_a’ [-wunused-variable] native.c:58:1: warning: command reaches end of non-void function [-wreturn-type] linking shared-object birch/native.so create install /usr/bin/install -c -m 0755 native.so /var/lib/jenkins/jobs /usr/bin/install -c -m 0755 native.so . /usr/bin/install: 'native.so' , './native.so' same file make: *** [-] error 1

i'm using rvm, ruby version ruby-1.9.3-p385-dev.

the problem isn't specific 1 gem either - removing birch results in same type of error bson native extensions.

it seems caused bad rvm install. installed rvm using apt (bad, bad idea), , looks purge didn't clean up. setting clean ec2 instance clean rvm install fixed it

ruby rubygems gem native

jquery addClass on substring text -



jquery addClass on substring text -

i developing twitter count characters , limit chacarter 160, when text length greater 160 want addclass() 161st-last character 161st-last character have text-decoration line-through. basicly can out length text using substring(). how addclass substringed text here's code:

$(document).ready(function(){ $("#tweet").attr("disabled","disabled"); $("#area").keyup(function(){ var chars=$(this).val().length; $("#message").text(160-chars); if(chars > 160 || chars <=0){ $("#tweet").attr("disabled","disabled"); $("#message").addclass("minus"); $(this).css("text-decoration","line-through"); //i want in 161st-last character not on text }else{ $("#tweet").removeattr("disabled"); $("#message").removeclass("minus"); $(this).css("text-decoration",""); } }); });

html

<div id="box"> <p>(maximum allowed characters : 160)</p> <p><textarea id="area" rows="10" cols="40"></textarea></p> <span id="message"> 160 </span> characters remaining <input type="button" id="tweet" value="tweet"/> </div>

and here's jsfiddle http://jsfiddle.net/zm9wd/4/

ps:sorry english language :-)

in order accomplish need utilize <div contenteditable="true"> instead of <textarea>, split content @ 160 character, set excess in <em> , style css.

markup

class="lang-html prettyprint-override"><div id="box"> <p>(maximum allowed characters : 160)</p> <p><div id="area" contenteditable="true"></div></p> <span id="message"> 160 </span> characters remaining <input type="button" id="tweet" value="tweet"/> </div>

js

class="lang-js prettyprint-override">$("#area").keyup(function(){ var content = $(this).text(); var chars=content.length; $("#message").text(160-chars); var html=""; if (chars > 160 || chars <=0){ html = content.substr(0, 160) + "<em>" + content.substr(160) + "</em>" } else { html = content.substr(0, 160); } $(this).html(html); setendofcontenteditable(this); });

source code setendofcontenteditable() taken here http://stackoverflow.com/a/3866442/1920232

css

class="lang-css prettyprint-override">#area { -moz-appearance: textfield-multiline; -webkit-appearance: textarea; border: 1px solid gray; font: medium -moz-fixed; font: -webkit-small-control; height: 68px; overflow: auto; padding: 2px; resize: both; width: 350px; } #area em { color: red; text-decoration: line-through; }

jsfiddle here

example working, believe there plenty of room improvement here.

jquery

database - Lock an entire single table but still allow to access other tables in the same session on MySQL -



database - Lock an entire single table but still allow to access other tables in the same session on MySQL -

is possible lock single table on mysql session , still able read , write on other unlocked tables on same session locked table while table still locked?

yes, lock tables this.

mysql database locking table-locking database-concurrency

mysqli - MySQL on Ubuntu 12.04 LOCAL_INFILE still disabled -



mysqli - MySQL on Ubuntu 12.04 LOCAL_INFILE still disabled -

on ubuntu 12.04 64bit lts, including mysql version 5.5.29 - trying load info local infile command in mysql, fails with

db error (1148) used command not allowed mysql version

i have done following:

added local-infile=1 [mysql] , [mysqld] sections of /etc/mysql/my.cnf file, , restarted mysql service;

added line alternative mysqli_opt_local_infile,true mysqli initiation:

function dbconnect($dbhost, $dbuser, $dbpass, $dbname) { $mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname); $mysqli->options(mysqli_opt_local_infile,true); if ($mysqli->connect_error) die('db connect error (' . $mysqli->connect_errno . ') '. $mysqli->connect_error); homecoming $mysqli; }

but still getting error? maybe local-infile alternative has not been compiled in mysql version?

mysqli ubuntu-12.04

visual c++ - Error: argument of type "cons char *" is incompatible with parameters of type "LPCWSTR" -



visual c++ - Error: argument of type "cons char *" is incompatible with parameters of type "LPCWSTR" -

i writing code in visual c++ access serial port of computer.

code given below:-

#include<windows.h> #include<stdio.h> #include<cstring> #include<string.h> #include<conio.h> #include<iostream> using namespace std; //#include "stdafx.h" #ifndef __capstone_cross_serial_port__ #define __capstone_cross_serial_port__ handle hserial= createfile("com1", generic_read | generic_write,0,0,open_existing,file_attribute_normal,0);

in above code getting error @ ""com1"" in lastly line of above code.

error given below:-

error: argument of type "cons char *" incompatible parameters of type "lpcwstr"

i want know why getting error , resolve it.

visual-c++

sql server - SQL - How to show the difference between multiple rows results -



sql server - SQL - How to show the difference between multiple rows results -

i have sql 2012 query gives me next results:

ip_country ds percentage ------------------------------------- commonwealth of australia 01/01/2013 0.70155 commonwealth of australia 02/01/2013 0.685 commonwealth of australia 03/01/2013 0.663594 commonwealth of australia 04/01/2013 0.737541 commonwealth of australia 05/01/2013 0.688212 commonwealth of australia 06/01/2013 0.665384 commonwealth of australia 07/01/2013 0.620253 commonwealth of australia 08/01/2013 0.697183

the results go on show different countries same dates , different percentages.

what need show, motion of percentages between dates same country only.

so between 02/01 , 01/01 difference 0.02 - can extract info , in excel, ideally have results come out motion in query.

you can utilize lag , lead access previous , next rows.

select *, lag([percentage]) on (partition [ip_country] order [ds]) - [percentage] diff, ([percentage] - lead([percentage]) on (partition [ip_country] order [ds])) / [percentage] [ratio] yourtable

sql fiddle

sql sql-server sql-server-2012 sliding-window

c# - How can I make sitecore showing an image (or other resources) -



c# - How can I make sitecore showing an image (or other resources) -

i installed clean sitecore 6.6 , enabled mvc back upwards using guide. environment sitecore 6.6, asp .net mvc 3 , razor, microsoft sql server express 2012, iis 7.5 , i'm using microsoft visual studio 2012 express web. have next code:

@model.pageitem.fields["title"];<br /> @model.pageitem.fields["image"].getvalue(true, true);<br /> @model.pageitem.fields["text"];<br /> sitecore.data.items.mediaitem item = model.pageitem.fields["image"].item; @sitecore.stringutil.ensureprefix('/', sitecore.resources.media.mediamanager.getmediaurl(item));<br />

result simple:

sitecore <image mediaid="{4dfd3abc-0bc0-41d2-bd38-705946a1368a}" mediapath="/images/xbox" src="~/media/4dfd3abc0bc041d2bd38705946a1368a.ashx" /> <p>welcome sitecore</p> /sitecore/shell/~/media/110d559fdea542ea9c1c8a5df7e70ef9.ashx

when navigate path specified in lastly line next error:

http error 404.0 - not found resource looking has been removed, had name changed, or temporarily unavailable.

i tried few things, e.g.:

media.useitempaths in web.config changed trye (or false) - nil works... media.requestextension in web.config set empty (ashx default) i have added ashx allowed extensions in web.config (because if cant have normal extensions, @ to the lowest degree want have working ashx link) i have added ashx iis 7.5 -> request filtering -> file name extensions

of course of study after each alter (just in case) restarted server , cleared browser's cache (actually, after few requests have disabled cache chrome).

i looking solution on sdn.sitecore.net no luck. i've spent more 3 hrs far looking solution , can't figure out going wrong... help or suggestions appreciated!

the field method of sitecore.mvc.helpers.sitecorehelper class allow output image field.

here's illustration view rendering outputs 3 fields:

@using sitecore.mvc.presentation @using sitecore.mvc @model renderingmodel @html.sitecore().field("title")<br /> @html.sitecore().field("image")<br /> @html.sitecore().field("text")<br />

john west has blogged extensively on sitecore mvc, might @ about mvc helpers sitecore asp.net cms post.

c# .net sitecore sitecore6

android - What to do after using UserSettingsFragment to login -



android - What to do after using UserSettingsFragment to login -

so able login , logout using usersettingsfragment, cannot seem additional functionality work after logging in. replace usersettingsfragment fragment of own after successful login , current code doesn't work this:

@override protected void onactivityresult(int requestcode, int resultcode, intent data) { usersettingsfragment.onactivityresult(requestcode, resultcode, data); super.onactivityresult(requestcode, resultcode, data); uihelper.onactivityresult(requestcode, resultcode, data); facebookhelperfragment fbhf = new facebookhelperfragment(); fragmentmanager fm = getsupportfragmentmanager(); fm.begintransaction().replace(r.id.fb_helper_frag, fbhf) .addtobackstack(null).commit(); }

when run it, looks fbhf flashes on screen momentarily, goes displaying default login screen usersettingsfragment shows logged in user's name , image logout button. also, don't want utilize deprecated code. using usersettingsfragment, haven't seen much usage of other logout only, or part of sessionloginsample.

thanks

the reply came me in sleep.

@override protected void onactivityresult(int requestcode, int resultcode, intent data) { usersettingsfragment.onactivityresult(requestcode, resultcode, data); super.onactivityresult(requestcode, resultcode, data); uihelper.onactivityresult(requestcode, resultcode, data); if (resultcode == -1) { facebookhelperfragment fbhf = new facebookhelperfragment(); fragmentmanager fm = getsupportfragmentmanager(); fm.begintransaction().hide(usersettingsfragment) .add(r.id.fb_helper_frag, fbhf).addtobackstack(null) .commit(); } }

just needed hide static usersettingsfragment before dynamically adding facebookhelperfragment.

android facebook facebook-login

svn - Move folders in Subversion using Tortoise -



svn - Move folders in Subversion using Tortoise -

i've been creating milestones of trunk within branches folder. getting numerous, , related, decided create /branches/milestones/1.0.0/ , throw 1.0.0 version's milestones in there.

if rename, tortoise has rename feature. how moving files within folder? how create subversion understand , maintain track instead of think delete-add?

in subversion, rename & move synonymous. both implemented re-create history followed delete.

svn tortoisesvn rename

Could Outdated GTK Affect Eclipse/SWT App (RSSOwl) Font Rendering? -



Could Outdated GTK Affect Eclipse/SWT App (RSSOwl) Font Rendering? -

rssowl, eclipse/swt app, on centos 6.3 gnome 2 desktop not rendering fonts other applications, , gnome itself.

centos 6.3's gtk version considerably older version needed current rssowl release.

while doesn't maintain running, older gtk business relationship font rendering differences?

eclipse fonts swt centos rendering

visual studio - Change the location of packages for NuGet using the release note 2.1 doesn't work -



visual studio - Change the location of packages for NuGet using the release note 2.1 doesn't work -

i trying alter location of default bundle folder nuget

i read many posts including documentation of nuget 2.1 release notes, new config nuget version 2.1 following:

<configuration> <config> <add key=" repositorypath" value=" c:\myteam\teampackages" /> </config> ... </configuration>

i read next thread, is possible alter location of packages nuget?

but configuration doesn't work?

the config work old 1 following:

<settings> <repositorypath>c:\myteam\teampackages</repositorypath> </settings>

i using visual studio 2012 update 1 including nuget bundle version 2.1

steps reproduce:

in solution directory, create file "nuget.config" edit nuget.config , add:

<settings> <repositorypath>c:\myteam\teampackages</repositorypath> </settings>

delete default packages folder

in visual studio, right-click on solution, , select manage nuget packages install bundle (any package)

verify bundle downloaded c:\myteam\teampackages

delete downloaded bundle in c:\myteam\teampackages

change nuget.config following:

<configuration> <config> <add key="repositorypath" value="c:\myteam\teampackages" /> </config> </configuration>

try install library again.

i find library installed in packages folder not folder???

>>steps reproduce:

>>in solution directory, create file "nuget.config" release notes looks nuget.config in next order .nuget\nuget.config recursive walk project (.nuget) folder root global nuget.config (%appdata%\nuget\nuget.config)

so if nuget.config in project/solution folder won't honored. can seek moving .nuget folder , reload solution.

visual-studio visual-studio-2012 nuget nuget-package

python 2.7 - Can I make pygame have a keyboard button with two functions? -



python 2.7 - Can I make pygame have a keyboard button with two functions? -

i making game pygame, , wondering if somehow create if press space bar once, image blitted, if press space bar again, different image blotted.

thanks, victor

oh yes. increment variable every time press space bar. , when becomes 2 (or multiple of 2), sec image should loaded.

python-2.7 pygame

Excel: Writing a macro to move specific columns -



Excel: Writing a macro to move specific columns -

i've tried searching, having problem finding answer. i'm not familiar code , know basic html. found (searching on here, actually) macro find columns titled nil through nil6, , delete them. have piece of macro set (see below).

the part can't find how move specific columns. example, column titled last-name not in same spot. want create move column a. column first-name should move column b... , on. possible? assistance appreciated!

sub deletecolumnbyname() 'find lastly column info in row 1 v = array("nil","nil2","nil3","nil4","nil5","nil6") lastcol = cells(1, columns.count).end(xltoleft).column 'loop through columns, starting @ lastly 1 delcol = lastcol 1 step -1 'delete columns specific name in row 1 bfound = false = lbound(v) ubound(v) if instr(1,cells(1,delcol),v(i),vbtextcompare) bfound = true exit end if next if bfound _ cells(1, delcol).entirecolumn.delete next delcol end sub

excel excel-vba

javascript - How to make jQuery filter(':contains("XXX")') Case insensitive? -



javascript - How to make jQuery filter(':contains("XXX")') Case insensitive? -

this question has reply here:

is there case insensitive jquery :contains selector? 9 answers

i using jquery 1.7.1. need create filter(':contains("xxx")') selector case insensitive. have tried this , this no luck means not working. precise, $('div:contains') works filter(':contain') not

use regular look , filter function :

yourjqueryset.filter(function(){ homecoming $(this).text().match(/xxx/i) })

if string xxx dynamically provided, use

var r = new regexp(str, 'i'); var outputset = inputset.filter(function(){ homecoming $(this).text().match(r) })

javascript jquery

redirect - Specific 301 redirection -



redirect - Specific 301 redirection -

i want follow 301 redirect in .htaccess: www.mysite.com/products/xxxxxx www.mysite.com/index.php?route=product/product&product_id=xxxxxx

where "xxxxxx" products id's

please help :)

//301 redirect entire directory redirectmatch 301 www.mysite.com/products/(.*) www.mysite.com/index.php?route=product/product&product_id=$1

redirect opencart

javascript - HTML5/JS Not Rendering Image in Canvas. -



javascript - HTML5/JS Not Rendering Image in Canvas. -

i'm working on web development lab, image not showing up. there doing wrong in referencing image? here link image itself: http://tuftsdev.github.com/webprogramming/assignments/pacman10-hp-sprite.png

note: copied image local directory, know the referencing correct.

<!doctype html> <html> <head> <title>ms. pacman</title> <script> function draw() { canvas = document.getelementbyid('simple'); // check if canvas supported on browser if (canvas.getcontext) { ctx = canvas.getcontext('2d'); var img = new image(); img.src = '"pacman10-hp-sprite.png'; ctx.drawimage(img, 10, 10); } else { alert('sorry, canvas not supported on browser!'); } } </script> </head> <body onload="draw();"> <canvas id="simple" width="800" height="800"></canvas> </body> </html>

you'll need set callback , draw image canvas 1 time image has loaded:

function draw() { canvas = document.getelementbyid('simple'); // check if canvas supported on browser if (canvas.getcontext) { ctx = canvas.getcontext('2d'); var img = new image(); // if don't set callback before assign // img.src, phone call ctx.drawimage have // null img element. that's why failing before img.onload = function(){ ctx.drawimage(this, 10, 10); }; img.src = "pacman10-hp-sprite.png"; } else { alert('sorry, canvas not supported on browser!'); } }

javascript html html5

javascript - content replace function -



javascript - content replace function -

i have follow question content replace function:

this current content replace function:

content = content.replace(/(<t t>(.*?)<t t>)/g, function(m,p1,p2){ homecoming p2,p1.replace(/ /g,"_").replace(/<t t>/g,"<html>"); });

when run:

this <t t>this test<t t> of

through html process text area:

<textarea id="content" cols="48" rows="8"></textarea><br /> <input type="button" value="process" onclick="process()" />

i receive output:

this <t_t>this_a_test<t_t> of replace.

rather want this:

this <t d>this_a_test<t d> of replace.

i know reason

<t t>

does not replace with

<t d>

is because function looking space , in turn omit space , create underscore. cannot figure out how not have happen, whilst still replacing space underscore within 2 tags, e.g.

this test

will become

this_a_test

the answerer previous question used useful resource .replace() method help me understand, much chagrin not figure out myself. give thanks much ahead of time help, if need here link example

so, according comment...

...so when "this <t t>this test<t t> of replace". entered in process text area result "this <t d>this_a_test<t d> of replace"...

... can do:

content.replace(/<t t>/g, "<t d>");

keep in mind /g flag in regular expressions matches patterns in tested string (g stands "global").

javascript replace

knockout.js - knockoutjs updated the table after edit -



knockout.js - knockoutjs updated the table after edit -

how update table after upate done. heres sample code. if click update table not updating.

self.updatecategory = function(category){ var r = confirm("are sure want update category " + self.id() + "?"); if(r==true){ //code here? } };

http://jsfiddle.net/comfreakph/2trjf/3/

there couple of things need do. first off, utilize knockout mapping plugin, , set categories property using that:

self.categories = ko.mapping.fromjs(category);

your code making array observable, not each item in it. using mapping plugin, create each category , properties observable.

then need update update function original category out , update values on it:

self.updatecategory = function (category) { var r = confirm("are sure want update category " + self.id() + "?"); if (r == true) { var original = ko.utils.arrayfirst(self.categories(), function (item) { homecoming category.id() == item.id(); }); console.log(original.createdat()); original.name(self.name()); original.remarks(self.remarks()); self.name(""); self.remarks(""); self.isselected(true); } };

you should find row in table automatically updated when alter values.

jsfiddle available.

knockout.js

Problems configuring rvm and `bundler not installed` -



Problems configuring rvm and `bundler not installed` -

i novice having major problems rvm. bundle install gives me error

`error: gem bundler not installed, run `gem install bundler` first.

even though know is installed, shows if run gem list -l. suspect that's returning list of scheme gems, suggest rvm problem. trying gem install bundler 1 time again doesn't help. i've looked around @ other people have had similar problems , can't find reply helps whatever situation i'm in. rvm info gives me output:

# rvm info system: system: uname: "linux box576.bluehost.com 2.6.32-20130101.60.1.bh6.x86_64 #1 smp tue jan 1 22:59:09 est 2013 x86_64 x86_64 x86_64 gnu/linux" system: "unknown/libc-2.12/x86_64" bash: "/ramdisk/bin/bash => gnu bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)" zsh: "/usr/bin/zsh => zsh 4.3.10 (x86_64-redhat-linux-gnu)" rvm: version: "rvm 1.18.8 (master) wayne e. seguin <wayneeseguin@gmail.com>, michal papis <mpapis@gmail.com> [https://rvm.io/]" updated: "22 hours 59 minutes ago" homes: gem: "/home7/contenw6/ruby/gems" ruby: "/home7/contenw6/.rvm/rubies/ruby-1.9.3-p194" binaries: ruby: "/home7/contenw6/.rvm/rubies/ruby-1.9.3-p194/bin/ruby" irb: "/home7/contenw6/.rvm/rubies/ruby-1.9.3-p194/bin/irb" gem: "/home7/contenw6/.rvm/rubies/ruby-1.9.3-p194/bin/gem" rake: "/home7/contenw6/.rvm/rubies/ruby-1.9.3-p194/bin/rake" environment: path: "/usr/local/jdk/bin:/home7/contenw6/.rvm/gems/ruby-1.9.3-p194@projecta/bin:/home7/contenw6/.rvm/gems/ruby-1.9.3-p194@global/bin:/home7/contenw6/.rvm/rubies/ruby-1.9.3-p194/bin:/home7/contenw6/.rvm/bin:/home7/contenw6/perl5/bin:/usr/lib64/qt-3.3/bin:/ramdisk/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/x11r6/bin:/home7/contenw6/ruby/gems/bin:/home7/contenw6/bin" gem_home: "/home7/contenw6/ruby/gems" gem_path: "/home7/contenw6/ruby/gems:/usr/lib/ruby/gems/1.8" my_ruby_home: "/home7/contenw6/.rvm/rubies/ruby-1.9.3-p194" irbrc: "/home7/contenw6/.rvm/rubies/ruby-1.9.3-p194/.irbrc" rubyopt: "" gemset: ""

if rvm utilize 1.9.3-p194@projecta --default environment section looks this:

environment: path: "/home7/contenw6/.rvm/gems/ruby-1.9.3-p194@projecta/bin:/home7/contenw6/.rvm/gems/ruby-1.9.3-p194@global/bin:/home7/contenw6/.rvm/rubies/ruby-1.9.3-p194/bin:/home7/contenw6/.rvm/bin:/usr/local/jdk/bin:/home7/contenw6/perl5/bin:/usr/lib64/qt-3.3/bin:/ramdisk/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/x11r6/bin:/home7/contenw6/ruby/gems/bin:/home7/contenw6/bin" gem_home: "/home7/contenw6/.rvm/gems/ruby-1.9.3-p194@projecta" gem_path: "/home7/contenw6/.rvm/gems/ruby-1.9.3-p194@projecta:/home7/contenw6/.rvm/gems/ruby-1.9.3-p194@global" my_ruby_home: "/home7/contenw6/.rvm/rubies/ruby-1.9.3-p194" irbrc: "/home7/contenw6/.rvm/rubies/ruby-1.9.3-p194/.irbrc" rubyopt: "" gemset: "projecta"

but when log in , seek 1 time again reverts first output above. i've screwed somewhere, , have no thought how prepare installation or problem coming from. help appreciated.

this looks previous ruby settings, check ~/.bashrc or ~/.zshenv variables set might contain mentioned paths

if not find seek checking in /etc:

grep -rn "/home7/contenw6/ruby/gems" /etc

update comments:

sed -i'' '/gem_home=/ d;' ~/.bashrc rm ~/.gemrc

rvm bundler

asp.net - get ASPX radiobutton text or value from javascript -



asp.net - get ASPX radiobutton text or value from javascript -

aspx radiobuttons within datalist template

<asp:radiobutton id="radiobutton1" runat="server" groupname="rdb" text='<%# eval("type1") %>' onclick="getr1(this)"/>

javascript

function getr1(val){ alert(val) }

if utilize function in html control, homecoming value not working in aspx radiobuttons. used code: onchange="getqty(this.options[this.selectedindex].value)" selected index aspx dropdownlist , works fine, maybe can help me figure out right syntax aspx rb. tried onclick="getr1(this.options[this.checked].value)", in advance

your code fine, need little change.

<asp:radiobutton id="radiobutton1" runat="server" cliientidmode="static" groupname="rdb" text='<%# eval("type1") %>' />

and

<asp:label id="label1" runat="server" style="font-size: x-small" text='<%# eval("type1") %>'></asp:label>

jquery getting radiobutton text:

$("#radiobutton1").click(function{ alert( $(this).siblings('label').text()); });

jquery getting asp:label text next radiobutton:

$("#radiobutton1").click(function{ alert( $(this).siblings('span').text()); });

hope helps :)

javascript asp.net radio-button

android - AndEngine Error in using Timer -



android - AndEngine Error in using Timer -

i'm using timer within andengine, it's tossing error @ me.

here's method error beingness thrown:

public void onpopulatescene(scene pscene, onpopulatescenecallback ponpopulatescenecallback) throws exception { mengine.registerupdatehandler(new timerhandler(3f, new itimercallback() { @override public void ontimepassed(final timerhandler ptimerhandler) { scenemanager.getinstance().createmenuscene(); mengine.unregisterupdatehandler(ptimerhandler); } })); ponpopulatescenecallback.onpopulatescenefinished(); }

i've tracked line here in engine class:

} { this.menginelock.unlock(); }

can help?

02-21 03:39:55.056: e/androidruntime(27796): fatal exception: updatethread 02-21 03:39:55.056: e/androidruntime(27796): java.lang.nullpointerexception 02-21 03:39:55.056: e/androidruntime(27796): @ edu.ian.andenginetest.scenemanager.disposesplashscene(scenemanager.java:50) 02-21 03:39:55.056: e/androidruntime(27796): @ edu.ian.andenginetest.scenemanager.createmenuscene(scenemanager.java:57) 02-21 03:39:55.056: e/androidruntime(27796): @ edu.ian.andenginetest.mainactivity$1.ontimepassed(mainactivity.java:73) 02-21 03:39:55.056: e/androidruntime(27796): @ org.andengine.engine.handler.timer.timerhandler.onupdate(timerhandler.java:98) 02-21 03:39:55.056: e/androidruntime(27796): @ org.andengine.engine.handler.updatehandlerlist.onupdate(updatehandlerlist.java:47) 02-21 03:39:55.056: e/androidruntime(27796): @ org.andengine.engine.engine.onupdateupdatehandlers(engine.java:597) 02-21 03:39:55.056: e/androidruntime(27796): @ org.andengine.engine.engine.onupdate(engine.java:585) 02-21 03:39:55.056: e/androidruntime(27796): @ org.andengine.engine.limitedfpsengine.onupdate(limitedfpsengine.java:56) 02-21 03:39:55.056: e/androidruntime(27796): @ org.andengine.engine.engine.ontickupdate(engine.java:548) 02-21 03:39:55.056: e/androidruntime(27796): @ org.andengine.engine.engine$updatethread.run(engine.java:820)

here's link github commit code: https://github.com/mkaziz/eecs-499---android-shooter/commit/63dab77fe43f70543b06ea6436249c8401b339bc

according code on github (you left on andengine forum, not here): in mainactivity class oncreatescene() function, phone call scenemanager's createsplashscene() executes andengine oncreatescenefinished() callback once. and, after homecoming oncreatescene() in mainactivity, execute same callback again. if trace andengine code, know cause onpopulatescene() in mainactivity executes twice too. so, you'll create 2 timer instances, , npe when sec timer disposing splash screen.

android andengine

ruby on rails - Is there a point in using Unit Test, Rspec, Cucumber and Capybara? -



ruby on rails - Is there a point in using Unit Test, Rspec, Cucumber and Capybara? -

i origin @ ruby , read different test methods/frameworks: unit test (minitest::unit latest ruby version), rspec, cucumber , capybara. don't grasp what's main "value" of each of them, differentiating other ones , if could/should using mix of of them ensure our app tested?

i utilize rspec functional testing , capybara/cucumber integration testing. rspec great writing tests create sure classes perform expect them to. cucumber great (along capybara, or webrat) making sure views perform way expect them to.

testing huge asset writing rails apps. it's amazing how i'll alter , tests grab there's unexpected side effect change. helps resolve bugs beingness able duplicate them in test , making test pass, causing bug resolved.

so: rspec (and factorygirl) making sure classes they're supposed , cucumber create sure user interacts web site in manner intended.

ruby-on-rails ruby unit-testing testing tdd

python - image-url and images_dir in pyScss? -



python - image-url and images_dir in pyScss? -

i'm trying utilize image-url compass helper in scss files described in this blog post, i'm unable find way set images_dir (or equivalent) in pyscss.

i've looked through docs , some of code, , pyscss doesn't seem have place set value, claim back upwards image-url.

is possible specify images directory in current versions of pyscss?

no, pyscss has no back upwards whatsoever either images_dir or images_path.

instead, image-url() paths always looked against static_root config variable only.

small comfort: static_root can callable yields (filename, storage) tuples; image_url() it'll utilize first value yielded. storage object needs implement django storage api (it'll utilize .modified_time() , perhaps .open() methods), perhaps utilize that intercept *.jpg, *.png, etc. paths 'redirect' images dir of choice.

the generated url (stubbornly) consist of static_url + path passed image_url().

i suggest add together feature request / bug study issue tracker request add together proper back upwards setting images_dir , images_path instead.

python compass-sass

c# - webapi error Multiple actions were found that match the request -



c# - webapi error Multiple actions were found that match the request -

i have accountcontroller has 2 actions here declarations:

httpresponsemessage postaccount([frombody] business relationship account) public httpresponsemessage postlogin([frombody]string email,[frombody] string pass)

running in fiddler, receiving error multiple actions found match request. im little confused on whats going on. should create 2 controllers login , register? standard practice.

you can have 1 parameter comes body in web api. if want multiple things in body, should wrap them in container class.

the error you're getting happening because have 2 actions start "post". can either create separate controllers, makes sense if you're posting different types of entities. or can utilize action-based routing , create route looks this:

config.routes.maphttproute("actionbased", "{controller}/{action}");

to distinguish between 2 actions when post.

c# asp.net-mvc asp.net-web-api

How to call java script in android? -



How to call java script in android? -

i new java script using in android,i have function in js file convert user name,how send i/p values , how retrieve info file in android activity button click.if 1 have thought please tell me in advance.

tru out :

public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); web = (webview) findviewbyid(r.id.webview1); web.setwebchromeclient(new mywebchromeclient()); web.addjavascriptinterface(new demojavascriptinterface(), "temp_1"); web.loadurl("file:///android_asset/temp_1.html"); } } final class demojavascriptinterface { private handler mhandler = new handler(); webview web; demojavascriptinterface() { } public void clickonandroid() { mhandler.post(new runnable() { public void run() { web.loadurl("javascript:init();"); } });

} }

final class mywebchromeclient extends webchromeclient { private static final string log_tag = "webviewdemo"; @override public boolean onjsalert(webview view, string url, string message, jsresult result) { log.e(log_tag, message); result.confirm(); homecoming true; } }

android

ASP.NET MVC using same view to edit and create -



ASP.NET MVC using same view to edit and create -

i've created view editing model. view strongly-typed , @ 1 point following:

@for (int = 0; < model.risks.count; i++) { @html.editorfor(m => model.risks[i])) }

now, working fine if collection not null, i.e if edit existing entity.

however i'd utilize same view creating new entity. crashes since collection null. how can create sure renders editor ?

one way have defaults when model new.

public ilist<risk> risks { { homecoming isnew() ? defaultrisks() : risks; } set { risks = value; } }

having property isnew can used in view illustration button text "create" or "save"

if end many if statements in view best seperate them.

that beingness said having same presentation model not bad thing.

asp.net-mvc-4 edit

linux - MySQL OUTFILE query complains that "file already exists" but the file does not exist at all -



linux - MySQL OUTFILE query complains that "file already exists" but the file does not exist at all -

i writing simple shell script dump table csv file. here part of it:

day=`/bin/date +'%y-%m-%d'` file="/tmp/table-$day.csv" rm $file query="select * table outfile '$file' fields terminated ',' enclosed '\"' lines terminated '\\n'" echo "$query" | mysql <connection_parameters>

i set in rm $file create sure file not exist prior query's execution.

however, when execute script, conflicting messages:

rm: cannot remove `/tmp/table-2013-02-08.csv': no such file or directory error 1086 (hy000) @ line 1: file '/tmp/table-2013-02-08.csv' exists

i cannot find outfile anywhere in machine.

so wrong.. ?

thank you.

i have found answer.

outfile creates file on mysql server, rather on mysql client's machine.

mysql linux

ruby on rails - undefined method `index_path' using relation -



ruby on rails - undefined method `index_path' using relation -

i next error using device , carrierwave gem:

undefined method `user_media_index_path' .showing .../user_medias/new.html.erb line #3 raised:

i have added index on user_id in user_media model

i have implemented file upload for single model don't know how seperate module.

new.html

form_for @media, :html =>{:multipart =>true} |f| upload image f.file_field :image f.submit end

this user model generated using device gem:

user.rb

class user < activerecord::base devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable attr_accessible :email, :password, :password_confirmation, :remember_me has_many :user_media, dependent: :destroy end

its model store user medias images,etc i;m using images future add together more types of media have created user_media model

user_media.rb

class usermedia < activerecord::base attr_accessible :anudio, :image, :video belongs_to :user mount_uploader :image, mediauploader end

this redirected when asked create action uploading image

user_medias_controller

class usermediascontroller < applicationcontroller def new @media = usermedia.new end def create @media=current_user.user_media.build(params[:media]) if @media.save render'index' else render'new' end end end

the routing details are:

routes.rb

projectx::application.routes.draw "dashboard/index" resources :dashboard, :usermedias "home/index" devise_for :users root :to => 'home#index' match 'uploder' =>'usermedias#new'

rake routes output after adding resources suggested @peter

dashboard_index /dashboard/index(.:format) dashboard#index /dashboard(.:format) dashboard#index post /dashboard(.:format) dashboard#create new_dashboard /dashboard/new(.:format) dashboard#new edit_dashboard /dashboard/:id/edit(.:format) dashboard#edit dashboard /dashboard/:id(.:format) dashboard#show set /dashboard/:id(.:format) dashboard#update delete /dashboard/:id(.:format) dashboard#destroy user_medias /user_medias(.:format) user_medias#index post /user_medias(.:format) user_medias#create new_user_media /user_medias/new(.:format) user_medias#new edit_user_media /user_medias/:id/edit(.:format) user_medias#edit user_media /user_medias/:id(.:format) user_medias#show set /user_medias/:id(.:format) user_medias#update delete /user_medias/:id(.:format) user_medias#destroy home_index /home/index(.:format) home#index new_user_session /users/sign_in(.:format) devise/sessions#new user_session post /users/sign_in(.:format) devise/sessions#create destroy_user_session delete /users/sign_out(.:format) devise/sessions#destroy user_password post /users/password(.:format) devise/passwords#create new_user_password /users/password/new(.:format) devise/passwords#new edit_user_password /users/password/edit(.:format) devise/passwords#edit set /users/password(.:format) devise/passwords#update cancel_user_registration /users/cancel(.:format) devise/registrations#cancel user_registration post /users(.:format) devise/registrations#create new_user_registration /users/sign_up(.:format) devise/registrations#new edit_user_registration /users/edit(.:format) devise/registrations#edit set /users(.:format) devise/registrations#update delete /users(.:format) devise/registrations#destroy root / home#index uploder /uploder(.:format) user_medias#new

the error points missing route in routes file. add together routes

resources :user_medias

ruby-on-rails

algorithm - Merge Sort Problems - Python -



algorithm - Merge Sort Problems - Python -

what's wrong code? prints part of vect values. seems while loop breaks @ point. don't understand why.

def print_list(vect): in range(0, len(vect)): print(vect[i]) def merge_sort(vect): left = [] right = [] result = [] in range(0, int(len(vect)/2)): left.append(vect[i]) in range(int(len(vect)/2), len(vect)): right.append(vect[i]) left.sort() right.sort() = 0 j = 0 while < len(left) , j < len(right): if left[i] <= right[j]: result.append(left[i]) += 1 else: result.append(right[j]) j += 1 print(len(result)) homecoming result vect = [3, 1, 5, 7, 10, 2, 0] vect = merge_sort(vect)

well, error after while loop

while < len(left) , j < len(right): ...

it may (and would) either i < len(left) or j < len(right), need append appropriate part's suffix answer. it's easy

result += left[i:] result += right[j:]

explanation:

imagine merge procedure: have , j @ 0 @ start, , @ every step move 1 of them forward. when stop ? when 1 of them reaches end. let's has reached end. hereby added whole left part result, there still elements in right between j , len(right), have add together them reply too.

offtop:

you implementing merge sort, please have

left = merge_sort( left ) right = merge_sort( right )

instead of

left.sort() right.sort()

attention: have add together next check code @ origin of merge function avoid infinite recursion:

if len( vect ) == 1: homecoming vect

also in print_list function can use

print vect

or @ least

for x in vect print x

python algorithm sorting merge

android check if mobile network is ckecked in setting or not -



android check if mobile network is ckecked in setting or not -

i know if mobile flag in setting checked or not.

with threads can check if 3g connected or not can not see if checkbox enable enabled or not in setting

how check if wifi/3g enabled? google android - how figure out if 3g , 2g turned on android: how check whether 3g enabled or not?

how can check this?

this function homecoming true if net connection available else homecoming false.

public boolean getconnection() { connectivitymanager manager = (connectivitymanager) getsystemservice(connectivity_service); boolean is3g = manager.getnetworkinfo( connectivitymanager.type_mobile) .isconnectedorconnecting(); boolean iswifi = manager.getnetworkinfo( connectivitymanager.type_wifi) .isconnectedorconnecting(); log.v("",is3g + " connectivitymanager test " + iswifi); if (!is3g && !iswifi) { toast.maketext(getapplicationcontext(),"your net connction off",toast.length_long).show(); homecoming false; } else { toast.maketext(login.this, "connected",toast.length_long).show(); homecoming true; } }

if not satisfy above reply can utilize try-catch. if not receive info means connection has problem.

android

c# - AltChunk corrupts rich text content control -



c# - AltChunk corrupts rich text content control -

i used altchunk object re-create info docx file rich text content command in file. re-create works fine. content command cannot cast sdtelement in openxml nor contentcontrol in vsto.

this code used

sdtelement sdtelement = destinationdocument.maindocumentpart.document.body.descendants<sdtelement>().where(b => b.sdtproperties.getfirstchild<tag>() != null).firstordefault(); string altchunkid = "altchunkid" + guid.newguid().tostring(); alternativeformatimportpart chunk = destinationdocument.maindocumentpart.addalternativeformatimportpart(alternativeformatimport parttype.wordprocessingml, altchunkid); chunk.feeddata(file.open("sourcefile", filemode.openorcreate)); altchunk altchunk = new altchunk(); altchunk.id = altchunkid; sdtelement.removeallchildren(); sdtelement.append(altchunk);

the first time code works fine. @ sec run first line throws unable cast exception. same problem occurs while using vsto @ client side contentcontrol object cannot hold content command in altchunk inserted. somehow procedure corrupts rich text content control.

is there doing wrong? or there improve alternative?

worddocument.maindocumentpart.document.body.descendants<sdtelement>() returns ienumerable<sdtelement> , assiging sdtelemtnt. seek using var or actual homecoming type.

update:

your code working one. doing wrong line sdtelement.removeallchildren();

an sdt element (content control) contains other elements sdtpr (content command properties), sdtcontent (the actual content within content control) etc. in below eg.

<w:sdt> <w:sdtpr> ... </w:sdtpr> <w:sdtcontent> .... </w:sdtcontent> </w:sdt>

what sdtelement.removeallchildren(); doing delete within sdt element , replacing them as:

<w:sdt> <w:altchunk r:id="altchunkidffebf242-30b3-4905-bf39-fc0077be9474" /> </w:sdt>

which making programme throw exception on secondrun in line destinationdocument.maindocumentpart.document.body.descendants<sdtelement>().where(b => b.sdtproperties.getfirstchild<tag>() != null).firstordefault(); replaced document sdt element has no sdtproperties , no tag or sdtcontent.

to workaround problem seek inserting altchunk block content command content element (sdtcontent) instead of sdt element straight below:

using ( filestream filestream = file.open("file.docx", filemode.open)) { chunk.feeddata(filestream); altchunk altchunk = new altchunk(); altchunk.id = altchunkid; //sdtelement.removeallchildren(); sdtelement.elements<sdtcontentblock>().firstordefault().append(altchunk); // going add together existing content. }

hope helps!

c# ms-word vsto openxml

python - Solved: Qt 4.8.4: Cannot connect slot to QListView::currentChanged() signal -



python - Solved: Qt 4.8.4: Cannot connect slot to QListView::currentChanged() signal -

when connecting slot qlistview::currentchanged(current, previous) signal using auto connection get:

qmetaobject::connectslotsbyname: no matching signal on_modelosview_currentchanged(qmodelindex,qmodelindex)

not using auto connection get:

attributeerror: 'builtin_function_or_method' object has no attribute 'connect'

i'm using pyside , code follows:

class modelos(qtgui.qdialog): def __init__(self, parent): qtgui.qdialog.__init__(self, parent) self.ui = ui_dialog() self.ui.setupui(self) # inicializa o modelo self.model = modelosmodel(self) self.ui.modelosview.setmodel(self.model) # inicializa o mapper self.mapper = qtgui.qdatawidgetmapper(self) self.mapper.setmodel(self.model) self.mapper.addmapping(self.ui.modelosedit, 0) self.mapper.tofirst() self.ui.modelosview.currentchanged.connect(self.onmodelosview_currentchanged) @qtcore.slot(qtcore.qmodelindex, qtcore.qmodelindex) def onmodelosview_currentchanged(self, current, previous): self.mapper.setcurrentindex(current.row())

where: modelosmodel subclass of qtabstractlistmodel , modelosview qlistview widget.

my goal utilize signal update mapper index user can select item wants in qlistview , edit in qplaintextedit using mapper.

edit: clear confusion code originated first error:

class modelos(qtgui.qdialog): def __init__(self, parent): qtgui.qdialog.__init__(self, parent) self.ui = ui_dialog() self.ui.setupui(self) # inicializa o modelo self.model = modelosmodel(self) self.ui.modelosview.setmodel(self.model) # inicializa o mapper self.mapper = qtgui.qdatawidgetmapper(self) self.mapper.setmodel(self.model) self.mapper.addmapping(self.ui.modelosedit, 0) self.mapper.tofirst() @qtcore.slot(qtcore.qmodelindex, qtcore.qmodelindex) def on_modelosview_currentchanged(self, current, previous): self.mapper.setcurrentindex(current.row())

i using auto connect feature got error:

qmetaobject::connectslotsbyname: no matching signal on_modelosview_currentchanged(qmodelindex,qmodelindex)

edit 2 (solution):

ok, checking docs 10th time , realized qlistview::currentchanged(...) slot , not signal. created custom subclass of qlistview signal needed , made currentchanged emit signal instead.

thanks help!

it's not coming connect() statement, setupui().

by default, setupui() adds phone call qmetaobject::connectsignalsbyname(widget), widget argument passed setupui() (in case: self).

that call, in turn, slots of self name resembling

on_childobjectname_signalname

and seek figure out if self has kid object named childobjectname (in sense of qobject::objectname(); if so, it seek connect signalname slot. don't that.

long story short: don't name slots using on_child_signal pattern unless plan utilize connectsignalsbyname.

(on other hand, it's quite convenient widgets created using designer: since designer give kid widgets name, can hook signals using feature, create slot called on_child_signal , magically work.)

python qt signals pyside qlistview

objective c - How to stop downloading file in Skydrive API -



objective c - How to stop downloading file in Skydrive API -

after starting downloading file, how stop downloading file? initiate download this:

[docdirskydrive appendstring:[nsstring stringwithformat:@"/%@ ",[[filesfromskydrive objectatindex:indexpath] objectforkey:@"name"]]]; nsmutablestring *downloadpath=[[nsmutablestring alloc]init]; [downloadpath appendformat:@"%@/content",[[filesfromskydrive objectatindex:indexpath] objectforkey:@"id"]]; [self.liveclient downloadfrompath:downloadpath delegate:self userstate:@"download"];

this code snippet downloading files, don't know how stop downloading files 1 time started.

try this

[docdirskydrive appendstring:[nsstring stringwithformat:@"/%@ ",[[filesfromskydrive objectatindex:indexpath] objectforkey:@"name"]]]; nsmutablestring *downloadpath=[[nsmutablestring alloc]init]; [downloadpath appendformat:@"%@/content",[[filesfromskydrive objectatindex:indexpath] objectforkey:@"id"]]; liveoperation *opperation = [self.liveclient downloadfrompath:downloadpath delegate:self userstate:@"download"];

then can cancel opperation using [opperation cancel];

objective-c skydrive

java - H2 Database - Creating Indexes -



java - H2 Database - Creating Indexes -

i'm using h2 database - running in embedded mode - , when app starts load h2 database info mysql database. i'm using linked tables point mysql tables.

my issue i'm trying speed time h2 takes create indexes on tables, particularly larger tables (5million+).

does know if safe run create index commands in separate thread while load next table's info h2? example: thread 1: loads table 1 -> tells thread 2 start creating indexes , thread 1 loads table 2, etc.

i can't utilize mvcc mode when loading tables because later on need utilize multi_threaded mode when selects. when seek using multi_threaded mode got locking errors though loading info discrete tables.

many thanks!

what might work (but i'm not sure if it's faster) create tables , indexes first, , load tables in parallel. should avoid locking problems in scheme table.

java database h2

php - Laravel 4 - Artisan error SQLSTATE[42000] -



php - Laravel 4 - Artisan error SQLSTATE[42000] -

i trying create new migration users table, have next schema:

schema::create('users', function($t) { $t->increments('id'); $t->string('username', 16); $t->string('password', 64); $t->integer('role', 64); $t->timestamps(); });

when seek run php artisan migrate terminal, next error:

[exception] sqlstate[42000]: syntax error or access violation: 1075 wrong table definition; there can 1 auto column , must defined key (sql: create table users (id int unsigne d not null auto_increment primary key, username varchar(16) not null, password varchar(64) no t null, role int not null auto_increment primary key, created_at timestamp default 0 not null , updated_at timestamp default 0 not null)) (bindings: array ( ))

the error has 'role' field, when removed seems run fine.

thanks in advance help or insight.

second parameter integer $autoincrement flag.

https://github.com/laravel/framework/blob/330d11ba8cd3d6c0a54a1125943526b126147b5f/src/illuminate/database/schema/blueprint.php#l443

php laravel

c# - Delegate and event -



c# - Delegate and event -

i have 2 forms.

form1:

public partial class panel1 { public void showexport(object sender, eventargs e) { ....... } }

form2:

public partial class panel2 { public delegate void showexportreport(object sender, eventargs e); public event showexportreport showexportclicked; private void buttonexport_click(object sender, routedeventargs e) { if (showexportclicked != null) { showexportclicked(sender, new eventargs()); } } }

when click button -

button.click = buttonexport_click

how can phone call panel1.showexport() panel2.buttonexport_click?

in panel1 have subscribe event:

pnl2.showexportclicked += new showexportreport(showexport);

c# events delegates

How to export only the selected layers in photoshop as individual png images -



How to export only the selected layers in photoshop as individual png images -

i want able export selected layers in photoshop individual png images (that trimmed properly). see script layers in psd, want layers i've selected. possible?

one workaround doing be: 1) hide layers don't want export 2) utilize usual file > scripts > export layers file , tick "visible layers only" option

hope helps :)

export photoshop layer

php - Populating Select List is Creating Duplicate/Multiple Options -



php - Populating Select List is Creating Duplicate/Multiple Options -

i've got database of states, cities, , listings. within each city, have multiple listings. example:

fl => miami => 10 listings

i trying populate state drop-down menu each state, however, sql query pulling rows , creating multiple entries of states. in illustration above, fl appearing 10 times in drop-down, because there 10 records in database.

but doesn't right in state drop-down menu. there should 1 fl. hope can help!

here query:

$squery = mysql_query("select * wp_postmeta wp_postmeta.post_id , wp_postmeta.meta_key = 'state'");

here output:

<?php while($state_name = mysql_fetch_array($squery)) { ?> <option value="<?php if(isset( $state_name['meta_value'] )) { echo state_name['meta_value']; } ?>"> <?php if(isset( $state_name['meta_value'] )) { echo $state_name['meta_value']; }?> </option><?php } ?>

try select distinct * or select distinct meta_value rather select *.

php mysql sql wordpress drop-down-menu

How to set a mime type on a file with php? -



How to set a mime type on a file with php? -

i writing unit test class , need generate few files different mime-types.

i know how set mime-type when sending file remote user (ala header()), how when using fwrite() on local server?

for file generated in method mime-type derived straight file extension?

i'm using php 5.3.x on ubuntu 12.04

files don't have mime types. identified file extensions. mime types set file extensions in /etc/mime.types. mime type tell client programme utilize open file.

php mime-types fwrite

Kendo stock chart not displayed on IE and firefox -



Kendo stock chart not displayed on IE and firefox -

here problem getting testing hard code info display stock chart working fine in google chrome , while coming other browsers ie , firefox graph not displaying series legend values in x axis , y axis can able see out series.

kendo-ui

string - Java StringTokenizer -



string - Java StringTokenizer -

i have next input (11,c) (5,) (7,ab) need split them 2 part each coordinates. intarray should have 11, 5, 7 , letter array should have c,,ab

but when seek using stringtokenizer, intarray should have 11, 5, 7 , letter array should have c,ab

is there way empty part of (5,)? give thanks you.

vector<string> points = new vector<string> (); string = "(11,c) (5,) (7,ab)"; stringtokenizer st = new stringtokenizer(a, "(,)"); while(st.hasmoretokens()) { points.add(st.nexttoken()); } } system.out.println(points);

list <integer> digits = new arraylist <integer> (); list <string> letters = new arraylist <string> (); matcher m = pattern.compile ("\\((\\d+),(\\w*)\\)").matcher (string); while (m.find ()) { digits.add (integer.valueof (m.group (1))); letters.add (m.group (2)); }

java string split

An exercise about drawing a rectangle class using the printf function -



An exercise about drawing a rectangle class using the printf function -

so problem next :

"write method rectangle class called draw draws rectangle using dashes , vertical bar characters. next code sequence

rectangle *myrect = [[rectangle alloc]init]; [myrect setwidth : 10 andheight : 3]; [myrect draw];

would produce next output : "

(i cant show image rectangle made out of "-" dashes , "|" bar characters. dashes width , bar characters height.)

i've started doing method :

{ int n; ( n = 1 ; n <= self.width ; ++n) printf ("-"); ( n = 1 ; n <= self.height ; ++n){ printf ("\n|"); } printf("\n"); ( n = 1 ; n <= self.width ; ++n){ printf ("-"); }

but seems not going work , cant display outer (|) lines . help me on one?

i believe working in objective-c, here simple set of code tested in c should translate on easily:

void printrectangle(int width, int height) { int n; int z; printf(" "); (n = 1 ; n <= width ; n++) printf ("-"); printf("\n"); ( n = 1 ; n <= height ; n++) { printf ("|"); for(z = 1; z <= width; z++) printf(" "); printf("|\n"); } printf(" "); ( n = 1 ; n <= width ; ++n) printf ("-"); printf("\n"); }

output width = 10, height = 5

---------- | | | | | | | | | | ----------

printf

XCode View Controller Not Updating in Do Loop -



XCode View Controller Not Updating in Do Loop -

i have loop want execute command every 1 sec while switch on.

the code works fine once, when don't have loop.

however, add together loop, none of labels in view controller updated, button storyboard doesn't work, , switch not toggle off. essentially, loop keeps looping, nil on screen work, nor can out.

i know i'm doing wrong. but, don't what. thoughts appreciated.

i attached code gets me in trouble.

thanks,

- (ibaction)roaming:(id)sender { uiswitch *roamingswitch = (uiswitch *)sender; bool ison = roamingswitch.ison; if (ison) { last=[nsdate date]; while (ison) { current = [nsdate date]; interval = [current timeintervalsincedate:last]; if (interval>10) { thecommand.text=@"on"; [self combo:sendcommand]; last=current; } } } else { thecommand.text=@"off"; }

}

ios , osx event based systems , cannot utilize loops in main (ui) thread want do, otherwise don't allow run loop run , events stop beingness processed.

see: mac app programming guide section "the app’s main event loop drives interactions".

what need set-up timer (nstimer) fire every second:

.h file:

@interface myclass : nsview // or whatever base of operations class { nstimer *_timer; } @end

.m file:

@implementation myclass - (id)initwithframe:(nsrect)frame // or whatever designated initializier class { self = [super initinitwithframe:frame]; if (self != nil) { _timer = [nstimer timerwithtimeinterval:1.0 target:self selector:@selector(timerfired:) userinfo:nil repeats:yes]; } homecoming self; } - (void)dealloc { [_timer invalidate]; // if using mrr only! [super dealloc]; } - (void)timerfired:(nstimer*)timer { if (roamingswitch.ison) { thecommand.text=@"on"; [self combo:sendcommand]; } } @end

xcode loops

c++ - Alphabetically sorting an array piece by piece -



c++ - Alphabetically sorting an array piece by piece -

i'm trying sort array of strings alphabetically have same frequency input file. start looping through entire array, , set indices @ points grouping of words have same frequencies. insertion sort between given indices. here's function:

//insertion sort array, checking same frequencies , moving words alphabetically downwards int startidx = 0; int endidx = 0; for(int k = 0; k < freq.length(); k++) { if(freq.at(startidx) == freq.at(k)) { endidx++; } else { insertionsort(startidx, endidx); //sort string array @ given indices startidx = endidx = k; } }

the function isn't sorting array...it works when indices set 0 length(), or other arbitrarily set values otherwise doesn't work.

c++ sorting character-arrays

salesforce - How to exit an apex function? -



salesforce - How to exit an apex function? -

i have apex function has void homecoming type. want exit function @ specific position. possible in apex without changing homecoming type pagereference?

in apex, homecoming keyword signals stop processing statements in function.

public void donothing() { return; }

salesforce apex-code visualforce

Trying to put new "Generate" option under Source menu in Eclipse -



Trying to put new "Generate" option under Source menu in Eclipse -

i'm trying add together new "generate..." alternative under source menu when right-click on java file. @ point, i'm trying menu alternative show haven't had success yet.

is there wrong plugin.xml file below far can see?

class="lang-xml prettyprint-override"><?xml version="1.0" encoding="utf-8"?> <?eclipse version="3.4"?> <plugin> <extension point="org.eclipse.ui.popupmenus"> <objectcontribution id="generatebuilderplugin.contribution1" objectclass="org.eclipse.core.resources.ifile"> <action class="generatebuilderplugin.popup.actions.generatebuilder" enablesfor="1" id="generatebuilderplugin.newaction" label="generate builder..." menubarpath="org.eclipse.jdt.ui.source.menu/generategroup"> </action> </objectcontribution> </extension> </plugin>

i ended going "hello, world command" template , adjusting needs.

below updated plugin.xml displays new "generate..." alternative on source menu. 1 needs setup command , handler class actual work. i'd recommend next "hello, world command" plugin template , tweaking needs.

<?xml version="1.0" encoding="utf-8"?> <?eclipse version="3.4"?> <plugin> <extension point="org.eclipse.ui.commands"> <command name="generate builder..." id="generatebuilderproject.commands.generatebuilder"> </command> </extension> <extension point="org.eclipse.ui.handlers"> <handler commandid="generatebuilderproject.commands.generatebuilder" class="generatebuilderproject.handlers.generatebuilderhandler"> </handler> </extension> <extension point="org.eclipse.ui.menus"> <menucontribution locationuri="popup:org.eclipse.jdt.ui.source.menu?after=generategroup"> <command commandid="generatebuilderproject.commands.generatebuilder" id="generatebuilder.menus.generatebuilder"> </command> </menucontribution> </extension> </plugin>

eclipse eclipse-plugin eclipse-rcp

javascript - Reload page if modified on server -



javascript - Reload page if modified on server -

i trying create page reload if has changed on server, ajax requesting page's own url every second, , checking if textstatus notmodified.

settimeout(function(){ $.ajax({ url : window.location.pathname, datatype : "text", ifmodified : true, success : function(data, textstatus) { if (textstatus !== "notmodified") { location.reload(); } } }); }, 1000);

however, textstatus success

just seek random variable avoid caching of response, itself. also, replace !== !=.

settimeout(function(){ $.ajax({ url : window.location.pathname + "?" + (new date()).getmilliseconds(), datatype : "text", ifmodified : true, success : function(data, textstatus) { if (textstatus != "notmodified") { location.reload(); } } }); }, 1000);

if doesn't work, seek replacing:

location.reload();

with:

location.href = location.href;

this depends on server side script. needs sent server side... setting no-cache , content-expires.

javascript jquery http

java - Change the date time format of an existing DateTime instance of Joda -



java - Change the date time format of an existing DateTime instance of Joda -

i have 2 date fields. user can take date jquery date-time picker converted utc format (via custom property editor of spring) , populated java bean upon submission of form.

these datetime instances java bean retrieved org.apache.commons.beanutils.propertyutils via reflection like,

final object object1 = propertyutils.getproperty(beanobject, firstdate); final object object2 = propertyutils.getproperty(beanobject, seconddate);

these objects type-cast datetime.

if(object1!=null && object2!=null) { final datetime startdate=((datetime)object1).withzone(datetimezone.forid("asia/kolkata")); final datetime enddate=((datetime)object2).withzone(datetimezone.forid("asia/kolkata")); system.out.println("startdate = "+startdate+"\nenddate = "+enddate); }

this produces next output.

startdate = 2013-02-17t22:45:59.000+05:30 enddate = 2013-02-18t22:46:00.000+05:30

i need conver these dates format - dd-mmm-yyyy hh:mm:ss

the next approach have tried doesn't work.

datetime newstartdate=new datetime(startdate.tostring("dd-mmm-yyyy hh:mm:ss")); datetime newenddate=new datetime(startdate.tostring("dd-mmm-yyyy hh:mm:ss")); system.out.println("newstartdate = "+newstartdate+"\nnewenddate = "+newenddate);

it gives next exception.

java.lang.illegalargumentexception: invalid format: "17-feb-2013 22:45:59" malformed @ "-feb-2013 22:45:59"

so how convert these dates required format?

a datetime doesn't have format. has value, number of milliseconds since 1st jan. 1970, , chronology. it's when transform datetime string need take format. , know how already, since you're doing in question.

so you're trying doesn't create sense.

java datetime jodatime

jquery - how to disable user interaction for slider? -



jquery - how to disable user interaction for slider? -

i implement jquery ui slider command slider javascript , won't block user interaction. utilize handle a.ui.slider-handle.

i have tried this:

$('a.ui-slider-handle').unbind()

, didn't work.

to disable user interaction , maintain slider enabled, use:

$('#slider').slider(); $('#slider.ui-slider, #slider ui-slider-handler').off();

example: http://jsfiddle.net/pwxr6/2/

jquery jquery-ui jquery-ui-slider

c# - How to get all sections by name in the sectionGroup applicationSettings in .Net 2.0 -



c# - How to get all sections by name in the sectionGroup applicationSettings in .Net 2.0 -

here's thought had:

i want little executable have app.config file multiple sections situated under sectiongroup "applicationsettings" (not "appsettings", don't need write file). each section have name corresponding module should loaded if set.

here's example:

<configuration> <configsections> <sectiongroup name="applicationsettings" type="system.configuration.applicationsettingsgroup, system, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" > <section name="executable" type="system.configuration.clientsettingssection, system, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> <section name="firstmodule" type="system.configuration.clientsettingssection, system, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> </sectiongroup> </configsections> <applicationsettings> <executable> <setting name="myfirstsetting" serializeas="string"> <value>my awesome feature setting</value> </setting> </executable> <firstmodule path="path modules assembly"> <setting name="importantsettingtothemodule" serializeas="string"> <value>some of import string</value> </setting> </firstmodule> </applicationsettings> </configuration>

now if define firstmodule section, want application load assembly. if section not defined, module should not loaded. should true not 1 module not yet defined number of them.

so need find out defined sections @ runtime. how that?

in add-on want become portable executable (= has run on mono well) backwards compatible .net 2.0.

it might interesting have @ project on github (currently @ this commit).

take @ configurationmanager.openexeconfiguration function load in configuration file.

then on system.configuration.configuration class you'll configurationmanager.openexeconfiguration you'll want @ sectiongroups property. that'll homecoming configurationsectiongroupcollection in you'll find applicationsettings section.

in configurationsectiongroupcollection there sections property contains executable , firstmodule configurationsection objects.

var config = configurationmanager.openexeconfiguration(pathtoexecutable); var applicationsettingsectiongroup = config.sectiongroups["applicationsettings"]; var executablesection = applicationsettingsectiongroup.sections["executable"]; var firstmodulesection = applicationsettingsectiongroup.sections["firstmodule"];

you want check null after getting configurationsectiongroupcollection object or configurationsection objects. if null don't exist in configuraiton file.

you can sections using configurationmanager.getsection

var executablesection = (clientsettingssection)configurationmanager .getsection("applicationsettings/executable"); var firstmodulesection = (clientsettingssection)configurationmanager .getsection("applicationsettings/firstmodule");

again, if objects null don't exist in configuration file.

to list of section names , groups do:

var config = configurationmanager.openexeconfiguration(pathtoexecutable); var names = new list<string>(); foreach (configurationsectiongroup csg in config.sectiongroups) names.addrange(getnames(csg)); foreach (configurationsection cs in config.sections) names.add(cs.sectioninformation.sectionname); private static list<string> getnames(configurationsectiongroup configsectiongroup) { var names = new list<string>(); foreach (configurationsectiongroup csg in configsectiongroup.sectiongroups) names.addrange(getnames(csg)); foreach(configurationsection cs in configsectiongroup.sections) names.add(configsectiongroup.sectiongroupname + "/" + cs.sectioninformation.sectionname); homecoming names; }

c# configuration mono .net-2.0 configurationsection