Posts

Showing posts from March, 2013

What is the difference between "Flush Magento Cache" and "Flush Cache Storage" in magento's cache management? -

Image
what difference between "flush magento cache" , "flush cache storage" in magento's cache management? sometimes cache location (like "/tmp/") or service (like memcache) shared other applications. "flush magento cache" removes entries magento reliably tracks it's own. "flush cache storage" clears might affect other applications if they're using it. normally location "var/cache/" in magento's folder not shared after all. safe use either button. (rarely) entries not tagged or magento loses track of them , second button has effect on them. tend use second button when i'm having difficulty tracking down cause of problem.

mysql - Django query executed in view returns old data -

i have view queries model populate form: class addserverform(forms.form): …snip… # compile , present choices hardware config hwchoices = hardwareconfig.objects.\ values_list('name','description').order_by('name') hwchoices = [('', '----- select 1 -----')] +\ [ (x,'{0} - {1}'.format(x,y)) x,y in hwchoices ] hwconfig = forms.choicefield(label='hardware config', choices=hwchoices) …snip… def addservers(request, template="manager/add_servers.html", template_success="manager/add_servers_success.html"): if request.method == 'post': # …snip… - process form else: # page called via - use default form addform = addserverform() return render_to_response(template, dict(addform=addform), context_instance=requestcontext(request)) additions hardwareconfig model done using admin interface. changes show in admin interface

c# - Silverlight Concurrent Data Sources for a Grid's Control -

i have following data model: camp -> campevent <- event. camp has campid , name associated it. event has eventid, name, start/end (dates). campevent has (campid,eventid)pk, campid fk, eventid fk. the tables used create domain model , domain service consumed client side on silverlight. i able display event's table in silverlight using grid. the grid has 2 template columns - 1 display checkbox, , display name of event. so problem somehow need check checkboxes when control goes in edit mode. i've noticed grid doesn't have ondatabound event, or doesn't have way of setting state of each checkbox checked other through binding. well, apparently in silverlight don't have luxury of messing around contents of gridviewrow. can, however, achieve changing underlying data source. in above scenario have control used creating instance of camp , associating 1 or many events. in sense control can either create or update "camp" object , re

networking - Is the packets loss caused by LAN or WAN? Its very confusing any idea? -

i have isp provider (telenet). provides via dhcp public ip there dsl modem. modem have rj45 cable connected 24 port switch. now in our local network: - switch port 1, have 1 voip phone - switch port 2, have voip phone each has default gateway 78.21.232.1 , subnet mask 255.255.240.0. different public ip such 78.21.235.x or 78.21.232.x series. question/confusion: when send packets our local network our local public ip's, traffic going isp default gateway? or straight inside our switch network? but saw many times gets packet loss in voip phone diagnostics. making me confused now. you've got several places more information packets go. first routing tables : $ ip route 192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.121 metric 1 169.254.0.0/16 dev eth0 scope link metric 1000 default via 192.168.0.1 dev eth0 proto static this shows interfaces ( virbr0 , eth0 ) us

android - LinearLayout Line up -

i have edittext , want imagebutton left of it. want edittext's width fill_parent except leave room imagebutton. right edittext isn't leaving room. have them nested in linearlayout. <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <linearlayout android:layout_height="wrap_content" android:id="@+id/linearlayout1" android:layout_width="fill_parent" android:orientation="horizontal" > <edittext android:id="@+id/edittext1" android:layout_marginleft="10dp" android:layout_height="wrap_content" android:layout_marginright="10dp"

c - address to string constant -

i addres of string assembler c, , need content of address. how it? google gives c++ examples reinterpret_cast, not working in c (i suppose). appreciate if note needed libs too, tenx #include <stdio.h> #include <stdlib.h> unsigned long const1(void); int main() { printf("const: %d\n", const1()); return 0; } if you've got address , know it's null terminated string, need treat string. printf("%s", (char*)alleged_string_address);

Basic C++ question from a novice programmer -

i novice c++ programmer , trying work on school lab. below, have pasted shell of program working on. in main, instantiating object car1 belongs class velocity . when try use instantiation function mpsconverter , error indicating expression must have class type. have done similar examples in class , format worked fine. ideas? if not appropriate forum simple questions this, please point me in right direction more appropriate one. thanks, al // p1_2.cpp : defines entry point console application. // #include "stdafx.h" #include <iostream> #include "conio.h" using namespace std; class velocity { private: int mpsinput; // input value: meters per second (mps) int kmphinput; // input value: km per hour int mphoutput; // output value: comverted value of km per hour miles per hour (mph) public: int kmphoutput; // output value: converted value of mps km per hour velocity();

c++ - Can't sort unordered_set -

i have unordered_set of class activestatuseffect set declared follows: boost::unordered_set<statuseffects::activestatuseffect> activestatuseffects; activestatuseffect defined follows: class activestatuseffect { public: statuseffect* effect; int reminaingturns; bool operator<(const activestatuseffect& ase) const { return *effect < *ase.effect; } bool operator>(const activestatuseffect& ase) const { return *effect > *ase.effect; } bool operator==(const activestatuseffect& ase) const { return *effect == *ase.effect; } bool operator!=(const activestatuseffect& ase) const { return !((*this) == ase); } }; the comparison between statuseffect's comparison between unique integer assinged each instance of status effect. however, if try sort effects follows: std::sort(statu

SVN Copy: Create destination path if it doesn't exist -

is there option can use create directory in case doesn't exist when i'm copying directory within svn server directory within same server? example: svn copy file:///home/svn/folder/app/trunk file:///home/svn/folder/app/branches/release ...when there's no /branches/ folder? know can if wanted create single level directory (it work if command stopped @ "/branches" want copy further "release"). if try command complain lack of /branches/ folder create /release folder in. any solution either obvious or creative this? i'd creates path structure specify if finds doesn't exist. add --parents option svn copy command (type svn copy more details , other things can copy).

php - returning javascript via ajax but it doesnt work -

i trying links appear after clicking business name appear in light box. on standalone page, possible send same code through ajax, not call light box anymore. help? this original file, supposed represent 3rd party publisher site, integrating our code: <html> <head> <script type="text/javascript" src="lib/js/jquery-latest.js"></script> <link rel="stylesheet" href="css/prettyphoto.css" type="text/css" media="screen" charset="utf-8" /> <script src="lib/js/jquery.ppo.js" type="text/javascript" charset="utf-8"></script> <script src="lib/js/sp.js" type="text/javascript" charset="utf-8"></script> </head> <body> publisher's website. <br> <div id="bizname1" onclick="showcomp(this.innerhtml)" id="bizname" class="bizn

sql - Oracle range and subquery -

i have table that trying query against , i'm not sure how go it. table name: schedule user_id startdate enddate sequencyid the situation have number of rows user_id = 0. represents open schedule can claim. if schedule gets claimed gets assigned specific user id. here tricky part comes in. trying pick user , display schedule times don't overlap have been accepted or been scheduled. here have far select * schedule user_id = 123456; that gets me ranges of times person has accepted select * schedule user_id = 0; this gets me schedule rows available. i'm not quite sure how combine them such final result list of schedule elements whos user_id =0 , startdate / enddate don't exist between startdate , endate ones assigned user. i think select * schedule user_id = 0 , (loop through schedule rows testing (startdate < loopstartdate , enddate < loopstartdate) || (startdate > loopenddate) the i

if statement - Ruby -- If Elsif Else Error -

i'm getting error here simple if else chain, , can't figure out going on. started learning ruby other day, know java, , trying re-write programs learn ruby faster. trying tally vowels , consonants. anyways here code... #!/usr/bin/ruby/ alphabet = 'abcdefghijklmnopqrstuvwxyz' array = alphabet.chars.to_a vowel = 0 cons = 0 puts array.at(1) in 0...26 if array.at(i) == "a" vowel++ elsif array.at(i) == 'e' vowel++ elsif array.at(i) == 'i' vowel++ elsif array.at(i) == 'o' vowel++ elsif array.at(i) == 'u' vowel++ else cons++ end#end if else chain end#end loop puts 'vowel: ' + vowel.to_s puts 'consonants: ' + cons.to_s here error getting: c:/users/kelan/documents/programming/ruby files/little programs/alphabet.rb:11: syntax error, unexpected keyword_elsif elsif array.at(i) == 'e' ^ c:/users/ke

finance - Ordering Table A based on Rank of Table B in R -

pretty newb question here, have not been able track down solution time: i have xts object of trading indicators ( indicate ) stock data looks like xom msft 2000-11-30 -0.59 0.22 0.10 2000-12-29 0.55 -0.23 0.05 2001-01-30 -0.52 0.09 -0.10 and table identical index corresponding period returns ( return ) looks like xom msft 2000-11-30 -0.15 0.10 0.03 2000-12-29 0.03 -0.05 0.02 2001-01-30 -0.04 0.02 -0.05 i have sorted indicator table , had return column name following code: indicate.label <- colnames(indicate) indicate.rank <- t(apply(indicate, 1, function(x) indicate.label[order(-x)])) indicate.rank <- xts(indicate.rank, order.by = index(returns)) which gives table ( indicate.rank ) of symbol names ranked trading indicator: 1 2 3 2000-11-30 xom

java - How to merge two sorted arrays into a sorted array? -

this asked of me in interview , solution provided: public static int[] merge(int[] a, int[] b) { int[] answer = new int[a.length + b.length]; int = 0, j = 0, k = 0; while (i < a.length && j < b.length) { if (a[i] < b[j]) { answer[k] = a[i]; i++; } else { answer[k] = b[j]; j++; } k++; } while (i < a.length) { answer[k] = a[i]; i++; k++; } while (j < b.length) { answer[k] = b[j]; j++; k++; } return answer; } is there more efficient way this? edit: corrected length methods. a minor improvement, after main loop, use system.arraycopy copy tail of either input array when end of other. won't change o(n) performance characteristics of solution, though.

jquery - how to show div based on hover over radio button -

update question: <asp:radiobuttonlist runat="server" id="rbl" repeatdirection="horizontal"> <asp:listitem text="none" value="0" selected="true" enabled="true"/> <asp:listitem text="float left" value="1" selected="false" enabled="true"/> <asp:listitem text="float right" value="2" selected="false" enabled="true"/> </asp:radiobuttonlist> <div id="divid0">0</div> <div id="divid1">1</div> <div id="divid2">2</div> <script language="javascript" type="text/javascript"> $(document).ready(function () { $('#divid0').dialog({ autoopen: false, }); $('#divid1').dialog({ autoopen: false, }); $('#divid2&

java - Builds are tagged unstable even when they are successful -

i running jenkins version 1.411 , use maven building. even though application builds successfully, jenkins treats unstable build. have disabled tests isolate problem. [info] ------------------------------------------------------------------------ [info] build success [info] ------------------------------------------------------------------------ [info] total time: 45.389s [info] finished at: wed may 11 12:16:57 est 2011 [info] [doclinks] skip document adaptiv generated site ... (no such directory: site) final memory: 27m/543m [info] ------------------------------------------------------------------------ channel stopped archiving artifacts email triggered for: unstable sending email trigger: unstable attempt send e-mail empty list of recipients, ignored. finished: success it's time ago used hudson/jenkins should have @ jenkins terminology unstable build : a build unstable if built , 1 or more publishers report unstable. example if junit publisher configured , tes

compilation - How to recompile red5 code at WEB-INF? -

i have editing opensource code of red5. don't know how recompile it. use javax @ cmd can't run. should do? to compile red5 need install apache ant , run ant in main red5 source directory build.xml file located, or import sources eclipse , build there. the latter method better if want modify source code. there're video tutorials made dominick accattato available on youtube . talks building red5 sources in 1 of them.

iphone - Do I need to install XCode4 in order to -

do need install xcode4 (and ios sdk 4.3) in order install app on iphone's ios 4.3.2 installed on them? i've installed app on iphone installed ios 4.3.2 on thought may have worked because had installed on phone when had older ios version. by way, i'm using xcode version 3.2.5 any appreciated! you should able test on ios 4.3 devices xcode 3.2.6.

fortran in Xcode -

how can programming in fortran xcode 3.2 osx? i try plugin gfortran http://www.macresearch.org/xcode_gfortran_plugin_update don't work me i'd suggest not using xcode. because xcode not designed fortran, there no significant advantages in using ide. i'd suggest using textmate.

Android development with Windows XP and no Android device -

hi, i'm planning learn android app development, don't have android device. can still learn using windows machine? if so, how check output? , can 1 suggest me tutorial beginners. yes can develop android application. you require.... a ide eclipse . android sdk --- includes android emulator. note:-- functionalities not supported android emulator , require android phone.

arrays - C++ Copying Pointers -

hi know how copy contents of 2d array pointer in c++ location , set pointer when make changes on copied pointer nothing happens original data? basically array pointer pieces on chessboard. goes piece * oldpointer = board[8][8] . want copy contents in pointer including methods getvalue(), getcolor() etc in pieces header file location , set pointer can operations there , test without having affect orginal data? read somewhere had use allocate() im not sure. please help in c++ define 2d array type follows (you need modern c++ compiler): #include <array> typedef std::array<std::array<piece, 8>, 8> board_t; if compiler doesn't support std::array can use boost::array instead: #include <boost/array.hpp> typedef boost::array<boost::array<piece, 8>, 8> board_t; now can use type above. can see need copy object pointer points: board_t* oldpointer = new board_t; // oldpointer // make copy of instance of object oldpointer points

android - Deleting last item from spinner deletes the entire list -

i trying use spinner control enable user delete list element. have 'add' button add elements list, , 'delete' button removes currently-displayed item list. it works expected except when user deletes last item in list. @ point, of list's items deleted. my code follows: @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); // grab our ui elements can manipulate them (for spinner) // or add listeners them (in case of buttons) m_mydynamicspinner = (spinner)findviewbyid(r.id.dynamicspinner); m_additemtext = (edittext)findviewbyid(r.id.newspinneritemtext); button addbutton = (button)findviewbyid(r.id.addbtn); button clearbutton = (button)findviewbyid(r.id.clearbtn); // create arrayadapter assign spinner m_adapterforspinner = new arrayadapter(this, android.r.layout.simple_spinner_item); ((arrayadapter)m_adapterforspinner).se

asp.net - Help: Error = NullReferenceException was unhandled by user code -

any appreciated... code works cleanly until error... error occuring @ line: sqldatasource3.updateparameters("techid").defaultvalue() = cint(technicianrow("techid")) here full vb code: imports system.data partial class incidentassignment inherits system.web.ui.page public incidentrow datarowview public technicianrow datarowview protected sub button1_click(byval sender object, byval e system.eventargs) handles button1.click 'check see if incident has been selected if gridview1.selectedindex = -1 button1.commandname = "" lblmessage.text = "you must select incident." else button1.commandname = "nextview" lblmessage.text = "" end if end sub protected sub button3_click(byval sender object, byval e system.eventargs) handles button3.click 'check see if incident has been selected if gr

Rails 3 respond_with json question -

having trouble generating json. trying render single active record result json this: @data = user.find(1) respond_with(@data, :include => :status) the json result is: { -user: { address: null email: "test@email.com" first_name: "test" last_name: "man" status_id: 1 username: "testguy" status: { } } } so whats problem? problem :include=>:status seems not bring on relation. in user model have belongs_to :status. how work on single result set? when this: @data = user.where("id = 1") respond_with(@data, :include => :status) the relation shows in json result set fine way. within array of objects, not want. any ideas? i assume status want include not 1 of http status codes (200, 201, etc.) nor object associated user object in way , own variable. using rails 3.0.10 , ruby 1.9.2 may have find 1 of these 2 solutions suitable you. instead of respond_with use render follows.

php - Is it possible to pass data to Oracle Trigger? -

i use oracle trigger log update/insert/delete query, possible pass php session_id oracle trigger ? append in query, possible ? how ? you can use contexts . right after have connected database - specify php session id context , read context in trigger.

iphone - Callback method before deallocating any Object -

is there way call method before deallocating nsobject class object. or is possible writing custom dealloc method nsobject class that can call method before deallocating object? as garbage collector not available iphone, wants create small framework handles memory leak @ runtime & create log files leaks (i known there instrument identify leaks still r&d , don't want implement garbage collector algo). we trying maintain list of allocated object. for example: a *a=[[a alloc]init]; nsstring * veribaleaddress=[nsstring stringwithformat:@"%p",&a]; nsstring *allocatedmemoryaddress=[nsstring stringwithformat:@"%p",a]; // global dictionary maintaining list of object nsmutabledictionary *objects; [objects setvalue: allocatedmemoryaddress forkey: veribaleaddress]; but when object deallocate want 1st look, whether address of object present in dictionary or not. if address present remove dictionary. please guide me, whether it's pos

wordpress - Remove/ Redirect URL query string -

example: http://dearearth.net/news/ ?cbg_tz=240 plugin site query string example , explanation: http://plugins.righthere.com/custom-backgrounds/multiple-schedule/?cbg_tz=480 i had come across in past of way remove unwanted ?cbg_tz=240 appended url. seems affecting analytics , creating dupes wth/ without string... i believe it's simple .htaccess edit. have .htaccess settings accomplish task? thanks! something similar: how remove url parameters in htaccess this should work: <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{query_string} . rewriterule (.*) $1? </ifmodule>

java - Android Restlet Wrap Crashing -

i using android 1.6 , restlet android edition 2.0.7... it crashes on wrap(): clientresource cr = new clientresource("http://myapp.appspot.com/restlet/"); irestletresource r = cr.wrap(irestletresource.class); mydata[] ss = r.getdatas(); saying that 05-10 20:40:56.272: error/androidruntime(435): java.lang.runtimeexception: unable start activity componentinfo{se.myapp.android/se.myapp.android.myappandroid}: java.lang.nosuchmethodexception ... 05-10 20:40:56.272: error/androidruntime(435): caused by: java.lang.nosuchmethodexception 05-10 20:40:56.272: error/androidruntime(435): @ java.lang.class.getdeclaredmethods(native method) 05-10 20:40:56.272: error/androidruntime(435): @ java.lang.classcache.getdeclaredpublicmethods(classcache.java:166) 05-10 20:40:56.272: error/androidruntime(435): @ java.lang.classcache.getdeclaredmethods(classcache.java:179) 05-10 20:40:56.272: error/androidruntime(435): @ java.lang.classcache.findallmethods(classcache.java:24

javascript - How to Remove Spacing between HTML Component and LAbel -

i have 2 radio buttons shown container.insert('<input type="radio" name="sex" value="date range"/> date range'); container.insert('<input type="radio" name="sex" value="duration"/> duration '); the issue , space being inserted between radio buton , label please see output here http://www.tiikoni.com/tis/view/?id=924d1b7 as can see , space being inserted between radio button , label date range you should fix css, maybe should fix things right away: <span><input type="radio" name="sex" id="duration" value="duration"/> <label for="duration">duration</label></span> it sets text label radio button, can click text change it, easier targeting small radio button. don't forget add "id" input

tomcat - mod_pagespeed and java app servers -

can 1 use mod_pagespeed tomcat application server? directly or indirectly? am correct in stating can use mod_pagespeed tomcat if use apache webserver proxy tomcat webserver? (does work mod_jk?) you can use mod_pagespeed tomcat. you're right you'll need use apache proxy tomcat. know works mod_jk since use in production. assume works mod_proxy , mod_proxy_ajp, can't confirm those.

deployment - MSBuild: OutputPath directory is empty -

i want deploy asp.net mvc site. have next script. <import project="..\myprojname\myprojname.csproj"/> <propertygroup> <newinstalldir>c:\deployfolder\</newinstalldir> <bindir>$(newinstalldir)bin\</bindir> </propertygroup> <target name="build"> <msbuild projects="..\myslnname.sln" properties="configuration=release;platform=any cpu;outputpath=$(bindir)" /> <copy sourcefiles="@(content->'..\myprojname\%(relativedir)%(filename)%(extension)')" destinationfiles="@(content->'$(newinstalldir)%(relativedir)%(filename)%(extension)')" /> <copy sourcefiles="@(none->'..\myprojname\%(relativedir)%(filename)%(extension)')" destinationfiles="@(none->'$(newinstalldir)%(relativedir)%(filename)%(extension)')" /> <makedir directories="@(folder-&

java - How do I know where "Program Files" are? -

i'm working on custom installer / launcher in pure java. how can tell path "program files" or equivalent? by calling following: system.getenv("programfiles"); will give path of programfiles folder in windows operating system.

asp.net mvc - Get result from an ActionResult directly in the controller -

i want able result actionresult generate directly in controller debugging purposes. how do that? something like: public actionresult parts(string id) { var parts = _repository.getparts(id); var action = json(parts); var generatedjson = xxxxx; return action; } for debugging purposes want use debugging tool such firebug or fiddler , if insist polluting modifying source code when in debug mode take @ javascriptserializer class (which internally used jsonresult class): var generatedjson = new javascriptserializer().serialize(parts);

php - Code to search for a specific code any file in a directory and sub directory -

ok pretty new php know can read directorys , files. i have been struggling malware problem on 1 of our sites , need write script search on host space. the code hackers putting in files */ $duoiek = base64_decode("l2hvbwuvdxnlcnmvd2vil2ixnjqzl3nslnrozwnozxnzl3b1ymxpy19odg1sl01lzgnvdxj0qmfja3vwb2n0mjawny9nzwrjb3vydejhy2t1cg9jddiwmdctmi9immigy3vzdg9tzxivqnviymxlcg9zdcbcywnrihvwl3b1ymxpy19odg1sl0jhy2t1chmvtwvkawfzdwzhy2ugmjawns9izwxwigfuzcbkb2n1bwvudgf0aw9ul2phdmegyxbpl0phdmfbuekvy29tl21lzglhc3vyzmfjzs9kyxrhdhlwzxmvc2vhcmnoaw5nl2nsyxnzlxvzzs90c2rlby5waha="); @include_once $duoiek;/* */?> i have no idea google blocks site when shows up. i have download files search in dreamweaver replace crap space , put back. i need script detect before google does. if 1 can give me pointers great i sure problem face or later. pure php solution find , replace string provided. alternatively, can obtain files have been modified. note: if use code, there no undo

ide - Finding Shortcuts in Aptana Studio 3.0 to Comment Code -

i can't find shortcuts comment code in aptana studio 3.0. need shortcuts both comment individual lines , commenting selected blocks of code. some have told me try comment shortcut win + / on windows os not appear workable. it depends on language you're writing in (is css, javascript, html?) for javascript: ctrl - / add or remove // single line of code, or multiple selected lines. the standard java commenting shortcuts are: ctrl - / add/remove // single line of code, or multiple selected lines. ctrl - shift - / add /* */ around selected code. ctrl - shift - j add javadoc comments. you can find out shortcuts hitting ctrl-shift-l, bring list of available shortcuts. change depending on if have selected, type of file you're editing, etc. "add comments", "toggle block comments", "toggle js comments", , forth.

display html embedded data in iphone -

i'm wondering whether there's control display html embedded data in iphone. need display information on web. data saved database html tag. so there anyway me display data accordingly.. you can use uiwebview , load html using - (void)loadhtmlstring:(nsstring *)string baseurl:(nsurl *)baseurl

Android Button Response Problem -

hi since using button , on click of button connects web service. problem when press button not showed me has been clicked , goes connect internet , web service. after connecting shows me response has been clicked. in short response of button slow. if buton has internet connectvity in listener. know has ui thread. please friends guide me through this. thanks bunch, put following code in class: // need handler callbacks ui threads // background operations final handler mhandler = new handler(); // create runnable posting results final runnable mupdateresults = new runnable() { public void run() { // task needs done after webservice call complete. } }; and calling webservice use following code in button event: new thread() { public void run() { // place webservice call here. mhandler.post(mupdateresults); } }.start(); actually look

c# - using the update query with output clause in the dataadapter -

i using following query sqldataadapter's update command. example update employee set empage=@eage, empdob = @edob empid = @eid output deleted.* i have read output clauses row rowupdated event handler. how do this. i don't think can use rowupdated event accomplish this. since using custom update statement assume not using sqldataadapter.update() method raises rowupdated. instead should execute query using sqldataadapter.fill(dataset) . output rows stored in dataset.

asp.net mvc - custom validation attribute not working on client, just on server -

i trying implement custom attribute validation, similar 1 demonstrated here in scottgu's blog: http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx i have custom validator attribute email: public class emailattribute : regularexpressionattribute { public emailattribute() : base("^[a-za-z0-9](([_\\.\\-]?[a-za-z0-9]+)*)@([a-za-z0-9]+)(([\\.\\-]?[a-za-z0-9]+)*)\\.([a-za-z]{2,})$") { } } my class uses this: [required(errormessage = validationcim.msgobaveznopolje)] [email(errormessage = validationcim.msgmailneispravan)] [stringlength(validationcim.lensrednjepolje, errormessage = validationcim.msgsrednjepolje)] public string mail { get; set; } and works on server side, model validated ok, , everything. client side validation not activate second attribute, works required, , works stringlength not email. have tried including both jquery , microsoft ajax scripts, there seems no differe

Can any one tell me how can show same view of .docx file in the textarea using php -

i want show same view in textarea .docx file. you try docvert or livedocx

c# - Html.DropDownListFor binding problem -

so have these 2 tables - products, measurement_unit . products: (id int, name varchar(20) , id_um int ) id_um reference primary key of measurement_unit table , id primary key of table. measurement_unit: (id_um int, name varchar(20)). id_um primary key mapped 2 using linq sql. when want create new product need choose list of unit measurement, meaning dropdownlist names want bind id selected one.... i'm doing in controller create action (create new product): var items = new list<selectlistitem>(); foreach (var t in db.measurement_unit) items.add(new selectlistitem() { text = t.name.tostring(), value =t.id_um.tostring() }); viewdata["um"] = new selectlist(items, "value", "text"); now, view: <%: html.dropdownlistfor(model=>model.id_um, (ienumerable <selectlistitem>)viewdata["um"])%> but following error: the viewdata item has key 'id_um' of type 'system.int32

c# - appending info to a text file -

i have web site adding records database , info writing log file part of website. info written file fine...the question have how add information each input database. @ moment information put int lof file each new insert database existing record in log file seems overwritten , replaced new insert there 1 record added log file. advice perhaps... code used in btnclick event. protected void btnsubmitrating_click1(object sender, eventargs e) { int rating = 0; try { if (radrating.items[0].selected) { rating = 1; } if (radrating.items[1].selected) { rating = 2; } else if (radrating.items[2].selected) { rating = 3; } else if (radrating.items[3].selected) { rating = 4; } else if (radrating.items[4].selected) { rating = 5; } filestream rate = new filestream(server.mappath("~/ratebooks.log&

php - Publish "commented on" story to my page's Facebook wall -

i have fb comments plugins each page on site. have fb app site, , page on fb. i comment on particular page on site using php sdk (or other server-side means) in such way "xxx commented on yyy" story appears in page's feed, i.e. comment on site /as/ page, , have comment appear in page's feed. i able (after suffering) post comment page, e.g. curl -f access_token=... -f message=test -f id=http://.... -f http://graph.facebook.com/comments but using method there no story on page's feed. any ideas? from understand, want comments website's page app show on personal newsfeed when make comment page. i submit facebook because seems shortcoming of api. i'm pretty sure there no real way make page's comments show on feed though own. sorry

android - How to avoid the battery drain while implementing the GPS? -

in app i'm using gps listener. need turn off gps , activate later. i'm using locationmanager.removeupdates(locationlistener); to turn off gps. turn gps off. later i'm not able turn on? there other methods turn off gps? for activating gps i'm using locationmanager.requestlocationupdates(locationmanager.gps_provider, updatesinterval, 0, locationlistener); you can make service implement location listener when ever want start location listener can start service , put ocationmanager.requestlocationupdates(locationmanager.gps_provider, updatesinterval, 0, locationlistener); line in oncreate() method and when want close location update stop service , put line locationmanager.removeupdates(locationlistener); to ondistroy() method

linux - `GLIBC_2.7' not found error in Android emulator while launching the AVD File -

i using red hat 5 , android-sdk_r11-linux_x86.tgz sdk. getting `glibc_2.7' not found error when try start virtual device android sdk , avd manager. any on useful. -thanks, ron if @ sdk requirements see glibc >= 2.7 required. afaik rhel 5 (5.6) uses glibc 2.5 you compile glibc >= 2.7 separated directory instance /usr/local/glibc-new , launch avd manager exporting variable ld_library_path=/usr/local/glibc-new this should work

Adding an image to an exsisting JPanel inside of a JFrame -

so, i'm in ap computer science class, , our final project make program display bunch of different concepts have learned. 2 of displaying images, , adding buttons. i decided make cheesy decision-based rpg shows if-else branching. figured out how menu in has start button, , opens input dialog box. can't figure out how add image same jframe button located on. know displays image either above or below button. learned how display images, examples extended classes display image. can't figure out how invoke sort of draw or bufferedimage method within existing code or put it. maybe make call different class has image code in it? here have far. public class smashing extends jpanel { public static void main(string[] args) { jframe frame = new jframe("input dialog box frame"); jbutton button = new jbutton("start nigel's adventure"); button.addactionlistener(new actionlistener() { public void actionperformed(ac

windows - Recommend fast C++ UI library with small memory footprint -

i want write app reacts global shortcuts , accepts commands (the way launchy does). i'm trying minimize time between pressing shortcut , moment window appears on screen , operational. can suggest ui library (with argumentation) helpful? looked qt , wxwidget i'm afraid app heavy (in memory / processing speed way) - , need small window doesn't need pretty. .. or should go native windows libraries? (the main target windows 7 machine) fast? small? windows-only? sounds want wtl . caveat: you'll need use vc++. also, recommend grabbing source straight out of svn , new release hasn't been packaged in quite time despite fact project gets updated regularity.

android - how to recieve the second activity intent on first activity -

i have created 2 activities,first activity comes , goes second page i.e. second activity,and second activity goes on first,what wanted when 2 activity goes first has data display in first activity.how can please help.thanks in advance. just sample code: intent intent = new intent(firstactivity.this, secondactivity.class); bundle b = new bundle(); b.putint("key", 1); intent.putextras(b); startactivity(intent); finish(); after it, can data in second activity: bundle b = getintent().getextras(); int value = b.getint("key", 0);

Why is a special file used in Android to store installation id instead of SharedPreferences? -

i trying figure out best way store application key , other application specific data. android uses file - http://android-developers.blogspot.com/2011/03/identifying-app-installations.html i found using sharedpreferences faster , more efficient. why android use dedicated file store installation id instead of using preferences? both require application context, not reason. i guess uuid persisted across installations if phone not factory-reset. an applications sharedpreferences removed when application uninstalled. if user uninstalled/re-installed , id stored in sharedpreferences id different after re-installation.

objective c - Remove the "Dismiss keybard" key from a UITextView's keyboard on iPad -

i have modal view uitextview, , user can enter text (or not) , close modal view. there no point of dismissing keyboard not dismiss modal view (this on purpose), , uitextview without keyboard looks silly. is there way hide or remove "dismiss keyboard" key keyboard? you can't hide or remove key, can disable using uitextviewdelegate protocol: - (bool)textviewshouldendediting:(uitextview *)textview { return no; } if uikit forces responder resign despite delegate (doubtful, haven't looked closely @ call stack), can force keyboard stay observing uikeyboarddidhidenotification , setting first responder uitextview: [myuitextview becomefirstresponder]

ruby - How do I deserialize YAML documents from external sources and have full access on class members? -

in ruby object can transferred, i.e. serialized, yaml document saving output of " to_yaml " method file. afterwards, yaml file can read again, i.e. deserialized, using yaml::load method. moreover, 1 has full access on members of underlying class/object. all of valid long i'm using ruby single platform. once serialize objects in java , deserialize them under ruby, cannot access object more because of nomethoderror exception. due to way objects/local data types named under different systems. given ruby class "car": # simple class describing car # class car attr :brand, :horsepower, :color, :extra_equipment def initialize(brand, horsepower, color, extra_equipment) @brand = brand @horsepower = horsepower @color = color @extra_equipment = extra_equipment end end creating simple instance: # creating new instance of class 'car' ... porsche = car.new("porsche", 180, "red", ["sun roof", "

java - Using getParameterValues and Arrays -

so getting parameters page, , putting them array, taking items in array , running substring method on them: string[] edit = request.getparametervalues("editid"); // system.out.println(edit); string editdel = ""; if (edit != null) { (int = 0; < edit.length; ++i) { string lf = edit[i]; editdel = lf.substring(0, lf.length() - 2); } } else { editdel = "0"; } // system.out.println(editdel); so example if pass params 3lf , 12lf previous page, system prints [ljava.lang.string;@520 variable edit , , prints 12 variable editdel . need store editdel in array, because should getting both 12 , 3 editdel variable put editdel print statement inside loop (int = 0; < edit.length; ++i) { string lf = edit[i]; editdel = lf.substring(0, lf.length() - 2); system.out.println(editdel); } } else { editdel = "0"; }

erlang and external authentication -

a simple scenario. user logs in through form baked high level framework (rails let's say) , starts chatting. chat erlang-written , authenticated users can participate in. means, every request (containing session id) comming client side needs verified (authenticated) inside erlang code somehow. erlang knows nothing logged users , needs ask framework information. the question how design communication between erlang , framework not cause additional bottlenecks? i thinking storing session ids in erlang well. additional effort related synchronization (when new users log in) , session timeouts causes headache. there nothing free lunch in case. if keep authentication authority outside erlang have deal headache. can provide caching inside erlang improve speed bottleneck , have deal cache coherency issues. imho best solution make erlang authentication authority , provide authentication high level framework.

php - Magento, Help with SQL Query to get full product URL's -

so, looking interact database outside of magento. upon reviewing tables in database, catalog_product_flat_1 seems store majority of information looking retrieve gets me final step. i trying understand relations within magento db , full product url's newly created table. the purpose of seo/ppc initiative having nice list of every product sku, name, brand, description , url directly product make work breeze. i have working fine aside full product url. i have been doing amount of reading , appears more people using sql injections within normal magento methods, looking database outside of site. any appreciated. running raw sql commands against magento database time-consuming, not upgrade-proof and, in cases, dangerous. use models made available in magento codebase perform queries. you achieve sku, name, brand, description , url done with: <?php require_once 'app/mage.php'; varien_profiler::enable(); mage::setisdevelopermode(true); ini_set('di

jquery call back function -

i have call function follows $('#lnkclientdata').click(function() { $('#clientdiv').slidetoggle(function(){ if($('#lnkclientdata').hasclass('open')) { $('#divnext').slidetoggle(); $('#lnkclientdata').removeclass('open').addclass('close'); } else { $('#divnext').slidetoggle(); $('#lnkclientdata').removeclass('close').addclass('open'); } } ); }); i want $('#divnext').slidetoggle(); code executed before outside $('#clientdiv').slidetoggle() function.... right outside function gets called first....what trying hide anchor when div slides in...but happens before div slides in... if($('#clientdiv').is(':visible')) { alert(''); // $('#di

ios - determine current zoomscale for mapview -

how can calculate current zoomscale mkmapview? use following code: #define mercator_radius 85445659.44705395 #define max_google_levels 20 - (double)getzoomlevel { cllocationdegrees longitudedelta = self.mapview.region.span.longitudedelta; cgfloat mapwidthinpixels = self.mapview.bounds.size.width; double zoomscale = longitudedelta * mercator_radius * m_pi / (180.0 * mapwidthinpixels); double zoomer = max_google_levels - log2( zoomscale ); if ( zoomer < 0 ) zoomer = 0; // zoomer = round(zoomer); return zoomer; } the return value of getzoomlevel method current zoom level of mapview property.

sql server 2008 - Group By in stored procedure error -

i created stored procedure return list of offices type of activities happen within each office. results reported reportviewer noticed each activity return creates table - can have 5 different tables each own activity happen in same office. want report table each office contain many activites there each office. thought if grouped in stored procedure results want getting column error saying: "...is invalid in select list because not contained in either aggregate function or group clause." i not sure how go here select, from, where, group statements: select o.officeid, o.officename office, ht.description hearingtype, h.hearingdate hearingdate, cr.description court, ct.[description]as casetype activity h inner join activityentry on h.activityentryid = he.activityentryid inner join activitytype ht on h.activitytypeid = ht.activitytypeid inner join [case] c on h.caseid = c.caseid in

iphone - Xcode sometimes forget resources -

i'm experiencing huge problem. i've got 1 ios app use base-ground others. copy project in different directories , overwrite graphs resources others same name , same sizes in res. the problem xcode (both 3 , 4) forget of them, if present , linked in resources group. i've noticed present in "copy bundle resources" of target. error happens on device , simulator. it happens images 1 different suffix such as: ~ipad,@2x some clues: -deleted .svn hidden folders -the image not referenced in xib, in code -the name correct ( i'm aware simulator isn't case sensitive while device is) -the target of file set corrctly in , in "copy bundled resources" -changing name of file (and code, of course) doesn't change weird behavior -"touch" file doesn't change -clean target doesn't make difference -restore simulator doesn't make difference -file isn't localized -deleting file , add again doesn't affect p

caching - How to get true after_destroy in Rails? -

i have after_destroy model callback regenerates cache after model instance has been destroyed. calling open("http://domain.com/page-to-cache") many pages need re-cached. the problem model instance apparently isn't destroyed yet @ time, because open url requests still register presence, , regenerated cache looks pre-destroy cache. how can run calls after model instance has been destroyed? you may able use after_commit callback after entire transaction has gone through database. different depending on version of rails you're using (2.3.x versus 3.x.x), following: # model_observer.rb class modelobserver < activerecord::observer def after_commit(instance) do_something if instance.destroyed? end end you can read documentation rails 3 after_commit callback here . if version of rails doesn't have after_commit hook, can try using this gem provide functionality.