Posts

Showing posts from July, 2013

Syntax error - PHP -

hi dreamweaver says there syntax error on following line. right? if (!in_array(array_reverse(explode(".",strtolower($file['name'])))[0],$allowedextensions)) indexing return value of function not supported in version of php in use. upgrade newer version, or turn separate statements.

workflow fires two times even if i do not change field value in CRM 2011 -

i have workflow in microsoft crm 2011 fires on field change. when workflow fires, first check boolean value of flag: if value yes set no otherwise if flag value no create "xyz" entity. my problem is : when change flag value no again fires , create entity "xyz". it's happening because plugin looping infinitely, triggers on , on again. you can prevent loop using iexecutioncontext.depth property http://msdn.microsoft.com/en-us/library/microsoft.xrm.sdk.iexecutioncontext.depth.aspx ipluginexecutioncontext context = ipluginexecutioncontext)serviceprovider.getservice(typeof(ipluginexecutioncontext)); if (context.depth > 1) { return; } this cancel plugin when depth deeper 1.

android - Restrict the build installing in the 10" Tab -

i have added following lines manifest.xml , still install .apk in 10" devices . want .apk file installed in 7" tablet . <supports-screens android:smallscreens="false" android:normalscreens="false" android:largescreens="true" android:xlargescreens="false" android:requiressmallestwidthdp="600" android:largestwidthlimitdp="700"/> <compatible-screens> <!--no small size screens --> <!--no normal size screens --> <!-- large size screens --> <screen android:screensize="large" android:screendensity="ldpi" /> <screen android:screensize="large" android:screendensity="mdpi" /> <screen android:screensize="large" android:screendensity="hdpi" /> <screen android:screensize="large" android:scre...

c# - How can I get the partition UUID of a disk in .NET -

i need able partition/filesystem uuid of partition, similar how can vol in windos , ls -l /dev/disks/by-partuuid in *nix, c# code. what's best way this? for reference, need able uuid either current directory, or "closest" mount upwards. edit: bad, should've said front: needs run on mono. you can write code both platforms , decide @ runtime based on environment.osversion.platform 1 use. make sure write implementations in separate methods (or classes), way runtime won't attempt load pinvoked libraries wrong platform. for windows can use getvolumeinformation or wmi described in other answer. linux can use directory mentioned in question possibly in conjunction pinvoking readlink or using mono.posix assembly.

php - Displaying mysql data through hidden field values -

i trying display mysql records through hidden field values, nothing displays. little help! here's code; html: <form name="form11" method="post" action="hpdata.php" enctype="multipart/form-data"> <input name="pro" id="pro" type="hidden" value= "cms" /> <input name="piror" id="piror" type="hidden" value= "p1" /> <input name="stat" id="stat" type="hidden" value= "in progress" /> <input type="submit" name="submit" id="submit" class="groovybutton" value="..."> </form> php: <?php $project = $_post["pro"]; $pirority = $_post["piror"]; $status = $_post["stat"]; mysql_connect ("one", "two", "three"); mysql_select_db (...

linux - text editor mode for calling bash command -

suppose want enter multiline command via bash know can append \ in end of line enter new line however possible enter legitimate "text editor mode" don't have enter \ , press enter suffice eg..you type in command command line before entering parameters press magic button allows enter vi mode enter stuff "vi mode" exit , text entered in "vi mode" turns parameters of command press enter command executes is possible in bash command line? if so, how do it? see man bash : edit-and-execute-command (c-xc-e) invoke editor on current command line, , execute result shell commands. bash attempts invoke $visual, $editor, , emacs editor, in order. per default bash configured emacs mode, hence emacs c-xc-e command. if vi can set bash vi mode: set -o vi . allows normal line editing vi way without invoking explicit editor.

Create XSLT from an XML to get desired XML -

i have situation here : consider following code example : <?xml version="1.0" encoding="utf-8"?> <school id="1" alias="abc" name="st.josephs" val=""> <teacher id="1">rose</teacher> <subject>maths</subject> </school> <school id="2" alias="bcd" name="" val=""> <teacher id="2">john</teacher> <subject>science</subject> </school> <school id="3" alias="abc" name="" val=""> <student rollno="12">sarah</student> <age>13</age> </school> <school id="4" alias="bcd" name="st.mary's" val=""> <student rollno="14">rosh</student> <age>14</age> </school> now here need design xslt ...

c# - No such component has been registered in the kernel's component container -

consider code: public class iocconfig { protected static standardkernel kernel { get; set; } public static void registerioc(httpconfiguration config) { using (ikernel kernel = new standardkernel()) { registerdependency(); config.dependencyresolver = new ninjectdependencyresolver(kernel); } } public static void registerioc() { registerdependency(); } private static void registerdependency() { if (kernel == null) { kernel = new standardkernel(); } kernel.bind<callcenterlogger>().toself().intercept().with(new timinginterceptor()); } public static t gettype<t>() { registerdependency(); return kernel.get<t>(); } } in line: kernel.bind<callcenterlogger>().toself().intercept().with(new timinginterceptor()); i error: error loading ninject component iadvicefactory no such comp...

c - Request webpage using url instead of ip address -

how can request webpage using url instead of ip address? when tried use url got error message. i using android application called c4droid , not have many libraries. many other examples needed libraries did not have, can using libraries included in c4droid? #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <string.h> #include <stdio.h> #include <stdlib.h> int main(void) { int socket_handle; struct sockaddr_in socket_detials; char *input_buffer; char *pinput_buffer; ssize_t bytes_received; ssize_t bytes_sent; char *phttpget; char *httpget = "get / http/1.0\r\n" "host: www.google.com\r\n" "\r\n"; phttpget = httpget; bytes_sent = 0; input_buffer = malloc(1024); if (input_buffer == null) { printf("sorry, couldnt allocate memory input buffer\n"); return -1; } memset(input_buffer, 0, 1024); me...

makefile - How a checker tool execution happens if make C=1 or make C=2 is done in linux kernel? -

how checker tool executed along compilation of linux kernel code when make c=1 executed? in detail : make c=1 [targets] check c source checker tool. default checker tool "sparse". here query is, how checker tool executed along compilation of c source? (i unable same information makefile of linux kernel). thank you. the makefile executes checker tool in same way executes compiler. search checksrc in scripts/makefile.build .

ASP.NET MVC3 link with image inside @Html.Raw -

good day, i'm try use action links url.action inside @html.raw in asp.net mvc3 project. works fine without @html.raw , images can't display on page, i'm try use html.encode inside raw, it's show me naked html on page. @html.raw(<a href="@url.action("actionname", "controller", new {id = 1})" target="_blank"> <img src="@url.content("~/content/images/simpleimage.png")"/> </a>) any ideas why it's not render right code?also when hover on place image pop me next code: sitename.com/controller/@url.action( i'm try shielding " it's not help edit this action link part of query database, display next: @html.raw(model.fieldwithhtmlcharactersindatabase) you need pass string, try this @html.raw("<a href='" + @url.action("actionname", "controller", new {id = 1})' " + target='_blank...

c# - async await usages for CPU computing vs IO operation? -

i know async-await keeps thread context , handle exception forwarding etc.(which helps lot). but consider following example : /*1*/ public async task<int> examplemethodasync() /*2*/ { /*3*/ var httpclient = new httpclient(); /*4*/ /*5*/ //start async task... /*6*/ task<string> contentstask = httpclient.getstringasync("http://msdn.microsoft.com"); /*7*/ /*8*/ //wait , return... /*9*/ string contents = await contentstask; /*10*/ /*11*/ //get length... /*12*/ int exampleint = contents.length; /*13*/ /*14*/ //return length... /*15*/ return exampleint; /*16*/ } if async method ( httpclient.getstringasync ) io operation ( in sample above) - gain these things : caller thread not blocked worker thread released because there io operation ( io completion ports...) (getstringasync uses taskcompletionsource , not open new thread) preserved thread context exception thr...

c++ - Strange construct that used as tag in boost::spirit::x3 -

what strange language construct x< class y > y; in following context? #include <iostream> #include <sstream> #include <typeinfo> #include <type_traits> #include <cstdlib> #include <cxxabi.h> template< typename t > std::string const type_info_str() { int status = 0; auto realname_(abi::__cxa_demangle(typeid(t).name(), nullptr, nullptr, &status)); switch (status) { case -1: return "could not allocate memory"; case -2: return "invalid name under c++ abi mangling rules"; case -3: return "invalid argument demangle"; } std::ostringstream oss; if (std::is_volatile< t >::value) { oss << "volatile "; } oss << realname_; std::free(realname_); if (std::is_const< t >::value) { oss << " const"; } if (std::is_rvalue_reference< t >::value) { oss << " &&...

c - How can I get a file pointer ( FILE* ) of known file in a specific path? -

to read/write file need file pointer in language c in unix environment. know file name , path, how file pointer using name , path. #include <stdio.h> file * pfile; pfile = fopen ("myfile.txt","w");

Android screen capture with root (service or background thread ) -

there app capture screen when shark android phone . 1)when app on active , capture screen without root . 2)when app stack , return home, need root permission capture screen . i want know implement function 2) root permission . in mind, root permission means root shell, flush command , exec . confuse how capture screen in shell command . if have root or shell permission, can use either screenshot or screencap command, reference: root@android:/system/bin # screenshot -h unknown option -- husage: screenshot [-s soundfile] filename.png -s: play sound effect signal success -i: autoincrement avoid overwriting filename.png root@android:/system/bin # screencap -h usage: screencap [-hp] [-d display-id] [filename] -h: message -p: save file png. -d: specify display id capture, default 0. if filename ends .png saved png. if filename not given, results printed s...

navigation - jQuery hover - button stays to be with hover effect -

$("#navigation li.active").next().hover(function() { $(this).css("box-shadow", "inset -4px 0 7px -5px black"); }); when release cursor button, button stays hover effect. can please how make normal hover effect, must shown when cursor on button. you need add mouse leave handler $("#navigation li.active").next().hover(function() { $(this).css("box-shadow", "inset -4px 0 7px -5px black"); }, function(){ $(this).css("box-shadow", ""); });

c++ - How to handle touch events of custom control in blackberry10 -

i have custom control called customcontextmenu.qml , has image , label in each row. want handle click/touch on image , label together. how should that? currently, add ontouch() in each container containing image , label, it's not working. using customcontextmenu control in main.qml . container { id: testpagecustommboxcontainer objectname: "testpagecustommboxcontainer" background:dropdownback.imagepaint attachedobjects: [ imagepaintdefinition { id: dropdownback repeatpattern: repeatpattern.fill imagesource: "asset:///images/dropdown_bg.png" } ] layout: stacklayout { orientation: layoutorientation.toptobottom } maxwidth: 200.0 maxheight: 180.0 horizontalalignment: horizontalalignment.right verticalalignment: verticalalignment.top container { id: testpagecustommboxretestcontainer objectname: "testpagecustommboxretestcontainer" preferredwidth:200.0 preferredheight:90.0 layout: stacklayout...

java - How to use Tess4J in 64 bit windows -

i want work tess4j in 64 bit windows. have following error : exception in thread "main" java.lang.unsatisfiedlinkerror: unable load library 'libtesseract302' can't change jvm, have use 64 bit can give me help? thanks install 32 bit java virtual machine , run tess4j on it. can have both 64 , 32 bit jres side side on 64 bit operating system. if "user friendly installer" not yield idea, copy existing installation folder before installing different one.

php - Call to system's arp command fails with shell_exec -

i has been searching long time in google not looking for. have local web application business in different building of office. staff use application in local network both wireless devices , desktop computer. want give them access through limited devices , machines. i can mac address of connected devices passing ip addresses arp , instance: arp -n 192.168.10.12 in terminal. but can't output when run same command in php script $output = shell_exec('arp -n 192.168.10.12'); echo "<pre>$output</pre>"; i tried commands such ls -l /var/www in shell_exec function, these commands display same in command line. question why can't run arp -n ipaddress command , how run it. i can't check mac address via router because business clients use network when come office. thanks in advance. i followed this link. i'm pretty sure www-user not allowed use arp command or reference full path. use full path /usr/sbin/arp . it...

silverlight - How to display message box in the center of the screen in windows phone? -

the message box displays in top of screen, there idea make message box appear in center of screen. have used normal code display message box, not worked, there option give position of message box, or coordinate system or postion or margin, bring message box in center of screen.

haskell - Where has hSetEncoding gone? -

i sure while ghc added ability explicitly set character encoding on handle . however, when in system.io , don't see relating character encodings. (i have haskell platform 2012.4.0.0) am blind, or mistaken? i investigated function hiding. summary: make sure use system.io package base, not package haskell2010. details: hoogle tells me there system.io.hsetencoding in latest base package. http://www.haskell.org/hoogle/?hoogle=hsetencoding checking documentation haskell platform 2012.4.0.0, see system.io module haskell2010 package. , module doesn't seem contain hsetencoding . http://lambda.haskell.org/platform/doc/2012.4.0.0/ghc-doc/libraries/haskell2010-1.1.0.1/system-io.html but not despair, there seems system.io base contains hsetencoding . http://lambda.haskell.org/platform/doc/2012.4.0.0/ghc-doc/libraries/base-4.5.1.0/system-io.html#v:hsetencoding so guess have make sure use system.io base , not haskell2010.

sql - DB2 Export-Import Error -

Image
i have db2 database in first vm computer. want import tables it. when export 1 of these tables first vm .ixf file perfect , can export it. when tried import new table on second vm got kind of problem , query : connect rs; import "c:\rs_cust.ixf" of ixf messages "a.txt" create rs.rs_customers; connect reset; how can solve ? you have force table creation, explained in reason code. for reason codes 1, 3, 4, 5, 7, 8, 9, 11, 14, 17, , 18: to force import utility create tables despite fact information missing, specify forcecreate parameter when issue import command create or replace_create parameter. http://pic.dhe.ibm.com/infocenter/db2luw/v10r5/topic/com.ibm.db2.luw.admin.cmd.doc/doc/r0008304.html : table 5. valid file type modifiers import utility: ixf file format it added in db2 v9.1: http://publib.boulder.ibm.com/infocenter/db2luw/v9/topic/com.ibm.db2.udb.rn.doc/doc/c0023922.htm

Can't get CKEditor to work Drupal 7 -

i have set in libraries folder, wysiwyg under modules. both enabled, have set users, cleared cache , browser cache, set wysiwyg profiles, selected ckeditor full html, added buttons , it's not there when go edit?? i'm lost spent quite bit of time on - suggestions great i installed ckeditor module, ckeditor library, , had hack ckeditor library folder creating new subdirectories appropriate files (it looking skin , language files in wrong directory within ckeditor library folder)... i'm using latest version of - why happening? have thought since happened me happening else well! if else has problem, ensure have these files in /modules/ckeditor/ckeditor/ folder: "lang/en-gb.js" "skins/kama/images/sprites.png" "skins/kama/editor.css" "skins/kama/icons.png" all these files in root folder default reason.

input - jquery - Transfer link title to a inputfield and submit -

i created "fake" tagcloud requested by. user able enter tag names , tag weights. create "wanted" tagcloud. what work on is, if click on 1 of tags, user should redirected search page tag should automaticly included in search input field. after form should automaticly submitted. my problem is, dont know how transfer link title inputfield on other page input field using jquery, or else... you can this. when user click on tag change document.location = search page.url?keyword=clicked tag value; . , on search page :: var keyword = document.location.split("?")[1].split("=")[1]; $("#search keyword text input").val(keyword); what doing when user click on tag redirect search page value in keyword=clicked tag value variable. and on search page fetching value , set search text box. hope helps , code not tested yet works.

php - how to place an Alphabet bar on joomla category list -

in joomla 3 can load categories under 1 particular category order alphabet. i want show alphabet bar below have created , placed on editing layout/joomla/content/category-default.php | | b | c | d | e | f | g | h | | j | k | l | m | n | o | p | q .... the catergories should show a apple art b breakfast ... when click on alphabet letter in bar should go particular area(id) on list. please tell if know how can group , place heading id category , need work on joomla files? you use alternative layout on categories view. use jlayout alphabet bar. in foreach https://github.com/joomla/joomla-cms/blob/master/components/com_content/views/categories/tmpl/default_items.php#l18 you'd have check new letter , if there put letter heading. the issue if there nothing under letter. still okay having link? if not you'd need plugin run query gather first letters of results.

oop - class name as variable in python -

i remember following code in c++: myobj = myclass(); typedef typeof(myobj) newclass; newclass newobj = newclass(); then myobj , newobj kind of myclass. now need write function in python , pass myobject function , new call constructor of myobject . have many class . question: how it? this creates reference myclass: >>> class myclass(object): ... pass ... >>> myobj = myclass() >>> newclass = myobj.__class__ >>> newobj = newclass() >>> myobj, newobj (<__main__.myclass object @ 0x102740d90>, <__main__.myclass object @ 0x102740d50>) this creates new class based on myobj's class: >>> myobj = myclass() >>> newclass = type("newclass", (myobj.__class__,), {}) >>> newobj = newclass() >>> myobj, newobj (<__main__.myclass object @ 0x102740d90>, <__main__.newclass object @ 0x102752610>) >>>

maven - Profile dependent web.xml -

im using force ssl configuration on production server tomcat. disable feature in development , know options are. configuration happens in web.xml file. build project using maven have few profiles id prefer set settings. somewhere in web.xml may have following setting: <transport-guarantee>confidential</transport-guarantee> if then, use property place holder transport guarantee property, , resource filter during build. replace line in web.xml like: <transport-guarantee>${transport.guarantee}</transport-guarantee> you can assign default value can "confidential" property ${transport.guarantee} in pom file or external properties file, , override in dev environment giving command line argument: mvn clean package -dtransport.guarantee="none" if using maven war plugin, resource filtering can enabled within pom file by: <configuration> <webresources> <resource> ...

coldfusion - Find value in array of structs -

i have array of structs in script, , need check inside entire array of structs if somewhere inside struct, "id" key has specific value. i loop, there better/faster way this? note needs compatible coldfusion 8, arrayfind not available. as peter suggests, it's hard given paucity of info provided, if key value unique in data structure, use structfindvalue() locate it. challenge here not pay attention key value in. not know adobe / macromedia thinking in providing structfindkey() , structfindvalue() , no structfindkeyvalue() . on whim checked cflib see if there udf cover ground. not there one, seems wrote (my memory sieve sometimes): structfindkeywithvalue() . that's written cf9, shouldn't take back-port cf8. this bit of general answer. if provide better info, can give better answer.

javascript - slideToggle() does not work properly in IE7 -

i experiencing problems jquery slidetoggle in ie7. works in ie8, ie9, ff, chrome, opera. when debug don't errors. thing that's happening event.preventdefault() reason ie7 isn't trying after if statement. here code: /* handling of open/close toggler button categories */ $('ul.categories').on('click', '.toggle button', function(event) { event.preventdefault(); var $categories = $(this).parent().next('.items'), $icon = $('.icon', this); $categories.slidetoggle(interface.animationduration, function() { //somewhere here stops. not slidetoggle. if ($(this).is(':visible')) { $icon.removeclass('white-arrow-down').addclass('white-arrow-up'); } else { $icon.removeclass('white-arrow-up').addclass('white-arrow-down'); } }); }); <ul class="categories"> <li class="toggle"><button type=...

c++ - Is it safe to compare pointers of same type? -

char** buffer{ /* buffer */ }; char* ptr1{buffer[0]}; char* ptr2{buffer[10]}; assert(ptr1 < ptr2); if 2 pointers point different locations in same buffer, safe compare them? i want know if range of pointers valid comparing: assert(rangebeginptr < rangeendptr) . you can compare pointers relational operators ( < , > , <= , >= ) provided both point element of same array, or 1 past array. else unspecified behaviour per c++11 5.9 relational operators . so, given: char xyzzy[10]; char plugh[10]; all these specified function correctly: assert(&(xyzzy[1]) < &(xyzzy[4])); assert(&(xyzzy[9]) < &(xyzzy[10])); // though [10] isn't there. but these not: assert(&(xyzzy[1]) < &(xyzzy[15])); assert(&(xyzzy[9]) < &(plugh[3])); the type doesn't come except has same type if you're comparing 2 elements in same array. if have 2 char * variables, that's unspecified if point different arrays though...

c# - The call is ambiguous: Html.LabelFor -

i upgraded mvc3 application mvc4 , getting error @ runtime. (trimmed down better) error cs0121: call ambiguous between following methods or properties: ' mywebcore.htmlhelperextensions.labelfor<coreviewmodel,string>(system.web.mvc.htmlhelper<coreviewmodel>, system.linq.expressions.expression<system.func<coreviewmodel,string>>, object) ' and ' system.web.mvc.html.labelextensions.labelfor<coreviewmodel,string>(system.web.mvc.htmlhelper<coreviewmodel>, system.linq.expressions.expression<system.func<coreviewmodel,string>>, object) ' i have own labelhelperextensions class contains labelfor method. both of web.config files have references mvc4 in them. how can use extension methods instead of mvc ones? my web.config: add assembly="system.web.mvc, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35 my views/web.config: add assembly="system.web.mvc, version=4.0.0.0, cu...

java.lang.NoClassDefFoundError from websphere -

i have problem can't figure out. context : was 7.0.0.19 version (with no precompilejsp) caused by: java.lang.noclassdeffounderror: org/apache/jsp/_xxx (wrong name: com/ibm/_jsp/_xxx) @ java.lang.classloader.defineclassimpl(native method) @ java.lang.classloader.defineclass(classloader.java:275) @ java.lang.classloader.defineclass(classloader.java:212) @ com.ibm.ws.jsp.webcontainerext.jspextensionclassloader.defclass(jspextensionclassloader.java:181) @ com.ibm.ws.jsp.webcontainerext.jspextensionclassloader._loadclass(jspextensionclassloader.java:133) it's jsp give problem, , on specific environment (no problem on others environments same configuration) xxx.class present in profile/tmp directory others jsp in same directory (that give no problem) , filesystem not full. tests i did copy of xxx.jsp xxxnew.jsp in same directory can access xxxnew.jsp without problem (so there no coding problem) did mv xxx.jsp xxx1.jsp , had no problem access jsp new named deleted xxx.cl...

Some issues when adding image to android contact -

i working on android application. in app have add details , image android contact. used following code private void addcontact() { // todo auto-generated method stub arraylist<contentprovideroperation> ops = new arraylist<contentprovideroperation>(); int rawcontactinsertindex = ops.size(); ops.add(contentprovideroperation.newinsert(rawcontacts.content_uri) .withvalue(rawcontacts.account_type, null) .withvalue(rawcontacts.account_name,null ) .build()); ops.add(contentprovideroperation.newinsert(contactscontract.data.content_uri) .withvaluebackreference(contactscontract.data.raw_contact_id, rawcontactinsertindex) .withvalue(data.mimetype,phone.content_item_type) .withvalue(phone.number, "9x-xxxxxxxxx") .build()); bitmap bm = getbitmapfromurl(imageurl); bytearrayoutputstre...

entity framework - How to apply DDD with Breeze.WebApi.EFContextProvider? -

i use breeze.js on client , breeze.webapi on server. build ef poco entities methods , domain services. there background processes running on server use business domain fine. the problem i'm not sure how use domain methods , services when saving client side changes on server efcontextprovider? for example: if client adds new task , specifies new task should generate new actions each existing invoice (breeze saveoptions.tag), domain service addactionstoinvoices should invoked add necessary actions existing invoices. new task , new actions should saved during same transaction. generally, able work domain need ensure aggregate roots fetched when calling domain methods , changes persisted @ end. that's pretty open ended question. think understand general point @ least saves more store changed data in database. business processes in own right happen save data. you try run these through single "savechanges" web api method. feels wrong. pretty savechan...

c++ - Generate Unit Tests from a scenario table where inputs and expected results are specified -

i'm trying generate post coding ut module. module classifies input data db, if match found, proper value returned. after building table possible input scenarios , expected results, discovered got on 50 tests create. tests same, except test name , inputs, kind of template seemed fit here, reducing code mess. what imagined, either macro creates such template , expands tests input data , expected result or using structure representing scenario table macro wrap up. (i guess c++ template adequate here). however, i'm not sure correct path take , know if can give recommendations of how tackle it. there question of how fits tdd approach.. here idea using cpputest: #define gen_test_mod_classifier(group_name, test_name, priority, iscompress, isx, expecting) \ test(group_name, test_name) \ { \ int hit; \ setupdb(priority, iscompress, isx); \ hit = func(priority, iscompress, isx); \ check_equal(expecting, hit); \ } usage example: gen_test_mod_classifier(classi...

sql - MySQL date converstion -

i have table in mysql, have date , time column. format of column 01 february 2013 12:49:40 . want extract date part , time part month part also. using month(01 february 2013 12:49:40) function it's throwing error. can't use substring , width of row not equal. should do. first convert real date (what have text, mysql doesn't know it's date) select str_to_date(your_column, '%d %m %y %h:%i:%s') then can use functions year(), month(), time(), whatever want... select year(str_to_date(your_column, '%d %m %y %h:%i:%s')) your_table... even better of course, change column datatype datetime or timestamp. spare str_to_date() function every time. do adding column datetime or timestamp table alter table your_table add column your_column datetime; then "copy" column with update yourtable set new_column = str_to_date(old_column, '%d %m %y %h:%i:%s'); then can drop current column. alter table drop column your_current...

c# - Connecting to the server machine 'wsbeta.fedex.com' failed -

i want start using fedex web service, downloaded sample code putted in site "fedex.com" developers. folowing error occured: unable automatically step server. connecting server machine 'wsbeta.fedex.com' failed. may because remote computer not exist or firewall may preventing communication remote computer it occured @ line: processshipmentreply reply = service.processshipment(request); i use c# thank you, i fixed problem, occurred because did not put correct account number in line: request.requestedshipment.shippingchargespayment.payor.responsibleparty.accountnumber = "client's account number"; thank james, best regards

ruby on rails - asset_path does not work in some views -

can't resolve issue in rails 4 app. me please. in controller in 'show' action try render view 'textile': render "textile" if @wallcovering.material.id == 2 || @catalog.id == 10 in view 'textile.html.erb' have: <%= image_tag "#{@catalog.title}/#{@wallcovering.title}.jpg", id: "textile_image" %> but in page source in production there plain path, without md5, , image couldn't found. even <%= asset_path("#{@catalog.title}/#{@wallcovering.title}.jpg") %> shows me plain path. have tag in view: <%= link_to catalog_wallcovering_path(@catalog, wallcovering), data: { remote: true, bgpath: asset_path("#{@catalog.slug}/#{wallcovering.title}.jpg") }%> and asset_path works fine here. there other controllers , views in app, assets work fine. i precompiled assets by rails_env=production bundle exec rake assets:precompile and upload public assets production server. where w...

html - Stop list item onclick event firing when when scrolling -

i have scrolling unordered list, part of html5 app on touchscreen device. problem when user scrolling release there finger list clicks element user used scroll. there way change onclick behavior fires if user has clicked , not scrolled? <ul class="search"> <a onclick="event()"><li>name</li></a> <a onclick="event()"><li>name</li></a> <a onclick="event()"><li>name</li></a> </ul> any appreciated can't find documentation on online. don't think click think mousedown mousemove mouseup down triggers click. you'll want minimum amount of move allowed before trigger click.

c# - Auto resize winform to show all of a picture -

i've got image box use preview screen shot define mouse. i'd have winform change size in accordance of size of picture. image size determined size of rectangle create using mouse, needs auto adjust. i have image box capable sizing show whole picture, how can make winform shows whole picture box? i tried using following, didn't work , looked @ winform settings couldn't see needed functionality require: // "this" winform in question // imagepreview name of picture box this.width = imagepreview.width; this.height = imagepreview.height; try this: this.size = new size(imagepreview.height, imagepreview.width); if form in maximized state, have convert "normal" window. this.windowstate = formwindowstate.normal; this.size = new size(imagepreview.height, imagepreview.width);

r - ETS model using Shiny -

im trying create web application new rstudio feature shiny . i'm trying ets state space model. want specify model type manually ( bold text in server.r ). i'm giving inputs within quotes in server.r. if give iputs within quotes not take. please me... ui.r library(shiny) shinyui(pagewithsidebar( headerpanel( "forecast", "flowserve"), sidebarpanel( fileinput('file1', 'select csv file', accept=c('text/csv') ), checkboxinput('header', 'header', true), radiobuttons('sep', 'separator', c(comma=',', semicolon=';', tab='\t') ), tags$hr(), numericinput("startyear", "start year , month",2010), sliderinput("month","",min=1, max=12,value=1, step=1, animate=t), tags$hr(), selectinput("error", "error type", list("multiplicat...

MySQL configuration changes corrupts existing databases -

i have used mysqlv5.0.95 myisam default storage engine , changed my.cnf innodb default storage engine , down-graded mysql v5.0.91. when accessing existing database tables. mysql shows doesn't exist. why existing databases has been corrupted after applying my.cnf changes?

windows - How to figure out the 'Public DNS Name' from within an Amazon EC2 instance? -

i have windows 2008r2 instance on amazon ec2 . able access "public dns name" within instance. public dns name can found on aws ec2 console. is there way this? unknown's answer technically correct (+1), in order provide background , more details, i'd mention respective amazon ec2 instance metadata , user data : instance metadata data ec2 instance can use configure or manage running instance. instance metadata divided categories. more information, see instance metadata categories . one of many available metadata categories public-hostname : the instance's public dns. if instance in vpc, category returned if enablednshostnames attribute set true. more information, see using dns vpc . you can retrieve instance metadata within running ec2 instance via dedicated uri http://169.254.169.254/latest/meta-data/ http capable tool, e.g. ubiquitous curl , highly recommended httpie ( a cli, curl-like tool humans ) , of course, obvious ...

php - CakePHP HABTM data not saving to database -

i have model genform has habtm relationship model pdffile . use generate list of checkboxes in genform index view. in genform model, added: public $hasandbelongstomany = array( 'pdffile' => array( 'classname' => 'pdffile', 'jointable' => 'gen_forms_x_pdf_files' ) here's fragment genform index.ctp view: <?php echo $this->form->input( 'pdffile', array('label' => 'select pdf files', 'multiple' => 'checkbox') ); echo $this->form->input( 'first_name' ); echo $this->form->input( 'last_name' ); ?> in controller, have basic save: if ($this->request->is('post')) { // form submitted $this->genform->create(); if ($this->genform->save($this->request->data)) { return $this->redirect(array('action' => 'generate', $this->genform->...

csv - Read string as variable RUBY -

i pulling following string csv file, cell a1, , storing variable: #{collector_id} so, cell a1 reads #{collector_id} , , code this: test = #excel_cell_a1 however, if this: puts test i this: #{collector_id} i need #{collector_id} read actual variable collector_id , not code using call variable. possible? thanks help. using ruby 1.9.3. you can use sub or gsub replace expected input values: collector_id = "foo" test = '#{collector_id}' test.sub("\#{collector_id}", "#{collector_id}") #=> "foo" i avoid use of eval (or @ least sanity check running) reduce risk of running arbitrary code receive csv file.

actionscript 3 - Actionscript3 parsing json with an object -

i have flash app in function have parse json passed object external api can't change. my json this: { "prodotti": [ { "titolo": "test", "marca": "", "modello": "", "cilindrata": "", "potenza": "", "alimentazione": "", "images": { "img": [ { "thumb": "admin/uploads/img_usato/small/qekabw95l5wh1alf6.jpg", "big": "admin/uploads/img_usato/big/qekabw95l5wh1alf6.jpg" }, { "thumb": "admin/uploads/img_usato/small/default.jpg", "big": "admin/uploads/img_usato/big/default.jpg" ...

Excel- Average days between group of dates -

i'm trying use excel calculate average frequency of delivery set of parts. have data set has 2 columns- part number , delivery date. i'm trying figrue out out oftne parts delivered, on average, in terms of days. tried using nested ifs averageif(a2=a2:b9999,datedif(xx)) etc, no avail. i'm looking this: input: part 8.1 part 8.8 part 8.15 output: part average delivery - every 7 days etc etc. ideas? if dates in columnb: =(max(b:b)-min(b:b)--1)/count(b:b) or: =(max(b:b)+1-min(b:b))/counta(b:b) should serve. edit if have multiple parts (the above assumed one) , list in no particular order pivottable may best (say top left-hand corner in d1), in tabular form part row labels , delivery 3 times Σ values (the first max, second min , third count). =(1+e3-f3)/g3 copied down should give average bumber of days between deliveries. example 5 in example (3 deliveries in 15 days).

Can I initialize Foundation 4 Tooltips in scope? -

i trying initialize foundation 4.3.1 tooltips in scope, on div class $(".some-class").foundation('tooltips'), instead of on document $(document).foundation('tooltips'). when this, tooltip on touch device (ipad), opens on tap not close on tap. doing wrong? how tooltip work properly. reason need because foundation tooltips conflict ckeditor. thanks. in foundation 4.3.1 source there condition handle touchstart touchend events hover. condition met automatically modernizr.touch available. in addition, there configurable option disable touch events tooltips. here link modernizr builder touch events pre-selected: http://modernizr.com/download/#-touch-shiv-cssclasses-teststyles-prefixes-load

java - Re-write the same text into an existing PDF document by using PDFBox -

it's important question , interested of you. i used pdfbox create simple pdf document. i'am trying do, read existing document , re-write same text it, , in same position. 1) firstly create pdf named "musique.pdf". 2)read existing document. 3)extract text document pdftextstripper. 3)find position of each character in document (x, y, width, fs, etc. ). 4)create table must contain x , y of each character, example tabel1 [0]=x1 tabel1[1]=y1 , table1[2]=x2, table1[3]=y2 , etc. 5) create boucle of pdfcontentstream re-write each character in correct position. the problem is: the first line wrote problem second line. "i notice if have example text formed of 3 lines , if assume contains 225 characters,,so if length of text, put length equal 231,,so can notice adds 2 spaces of end of each line,, when search position of each character, program not consider these added spaces" please run below code , tell me how resolve problem, please. my co...

ios - Objective-C: "format string is not a string literal (potentially insecure)" warning with macro -

i'm using macro simplify returning localised strings, so: #define getlocalstr(key, ...) \ [nsstring stringwithformat:[[nsbundle mainbundle] localizedstringforkey:key value:@"" table:nil], ##__va_args__] basically, if have entry in localisation strings file "name" = "my name %@"; , calling getlocalstr( @"name", @"foo" ); will return nsstring @"my name foo" when run however, like: nsstring * str = getlocalstr( @"name", @"foo" ); i "format string not string literal" warning. following advice of other answers on warning , replacing with: nsstring * str = [nsstring stringwithformat:@"%@", getlocalstr( @"name", @"foo" )]; i still warning, , besides, kind of defeats point of macro making life easier. how can rid of warning short of wrapping getlocalstr calls in #pragma suppressors? edit 27/08 after running through crd's answer , doing...

Reload a javascript using jquery -

i have made php file shows session meter joomla's frontend using javascript. have made other php file shows user's details , reloads using jquery. want is, when press jquery's reload button, javascript session meter reload too. session meter php: <?php // no direct access defined('_jexec') or die('restricted access'); $document = & jfactory::getdocument(); $document->addstylesheet('***/***/session_meter.css'); include('***/***/scripts.php'); $document->addscriptdeclaration($javascript); $output = array(); $session = & jfactory::getsession(); $expire = $session->getexpire(); $output[] = '<span id="log_res" class="">'.$expire.'</span>'; foreach ($output $item){echo $item;} ?> session meter javascript (part of it): <?php // no direct access defined(...