Posts

Showing posts from April, 2014

mysql - sql like search character -

mysql - sql like search character - hello wanted search after 5 character (yyyy-mm-dd) 2000-02-01 2001-01-01 2001-01-05 2001-03-03 i wanted mm value select * day , employee employee.id = day.employee , employee = "$_id" , day.leaveday "%$month%"; the problem if utilize % % (wildcard) 20001 - 03 - 03 , 2000-02-01, show how value mm? any ideas? in advance help, , i'm sorry if has been asked before i'm taking leaveday date, datetime, or timestamp column. if not first create 1 since you're storing dates. prevent invalid dates such 20001 showing up. utilize mysql extract function run this select * day , employee employee.id = day.employee , employee = "$_id" , extract(month day.leaveday)=3 mysql

javascript - How can i load js files in specific pages using jQueryMobile? -

javascript - How can i load js files in specific pages using jQueryMobile? - it's known fact jquerymobile loads pages ajax , not including in dom header content in every pages. i need load custom js file in pages, how can achive this? until have placed .js files in body, there problems code there it's not workaround. until can find solution utilize rel="external" workaround, need find reply question. you utilize javascript dynamically add together js file dom. this demoed here: http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml javascript javascript-events jquery-mobile

iphone - Duplicate protocol definition -

iphone - Duplicate protocol definition - getting warning message duplicate protocol definition of modalviewdelegate ignored defined protocol in modalviewcontroller.h file @protocol modalviewdelegate; -(void)dismissview:(id)sender; @interface modalviewcontroller : uiviewcontroller { id<modalviewdelegate>delegate; } @property (nonatomic, assign) id<modalviewdelegate>delegate; @end in modalviewcontroller.m file synthesize delegate in mainviewcontroller.h file @protocol modalviewdelegate -(void)diddismissmodal:(id)sender; @end @interface mainviewcontrollerontroller : uiviewcontroller <modalviewdelegate> -(void)showmodal:(id)sender; in mainviewcontroller.m not synthesize delegate am supposed delegate in mainviewcontroller.m file too? why i'm getting warning message of duplicate protocol definition? try remove @protocol modalviewdelegate; in modalviewcontroller.h , import mainviewcontroller.h in file. iphone ios4

What's the best way to standardize a development environment for a small team? -

What's the best way to standardize a development environment for a small team? - at work, (2 other developers , me) develop of our code on single internal machine (via network file sharing). machine runs our development environment (nginx, apache, php, mysql, memcache, gearman, etc), unruly installed on non linux environment. we're getting few more team members (one remote) , looking improve way manage mutual development environment (our developers utilize windows, mac, , linux). how team create mutual development platform? few things i'm thinking about: same setup (a single machine write code), create external (maybe spin cloud server). force utilize linux , replicate environment on thier development machines. create virtual machine replicates environment , develop within vm. i'm curious others doing... thoughts on best practices? in experience, i've used virtual machines (vmware) , has worked pretty in creating same environment big tea...

maven release plugin with parameterized version -

maven release plugin with parameterized version - is possible utilize maven release plugin multi-module project, of inter-module dependencies specified using parameter parent pom? when seek phone call release:prepare next error: [error] failed execute goal org.apache.maven.plugins:maven-release-plugin:2.1:prepare (default-cli) on project forest-parent: version not updated: ${some.version} -> [help 1] here plugin definition: <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-release-plugin</artifactid> <version>2.1</version> <configuration> <goals>deploy</goals> <tagbase>https://svn.domain.com/svn/project/tags</tagbase> <autoversionsubmodules>true</autoversionsubmodules> <tagnameformat>@{project.version}</tagnameforma...

c# - Unlock section in applicationHost.config programmatically -

c# - Unlock section in applicationHost.config programmatically - i have checked servermanagaer class , gives lot of functionality work iis, contains methods update values in applicationhost.config file, can't fine way unlock sections there. for illustration purpose appcmd.exe unlock config command used. need same programmatically. as said can run appcmd process. hint if don't console popup can redirect output. here code msdn // start kid process. process p = new process(); // redirect output stream of kid process. p.startinfo.useshellexecute = false; p.startinfo.redirectstandardoutput = true; p.startinfo.filename = "write500lines.exe"; p.start(); // not wait kid process exit before // reading end of redirected stream. // p.waitforexit(); // read output stream first , wait. string output = p.standardoutput.readtoend(); p.waitforexit(); more details see here c# .net iis

How to use OpenGL orthographic projection with the depth buffer? -

How to use OpenGL orthographic projection with the depth buffer? - i've rendered 3d scene using glfrustum() perspective mode. have 2d object place on 3d scene deed label particular 3d object. have calculated 2d position of 3d object using using gluproject() @ position place 2d label object. 2d label object rendered using glortho() orthographic mode. works , 2d label object hovers on 3d object. now, want give 2d object z value can hidden behind other 3d objects in scene using depth buffer. have given 2d object z value know should hidden depth buffer, when render object visible. so question is, why 2d object still visible , not hidden? i did read somewhere orthographic , perspective projections store incompatible depth buffer values. true, , if how convert between them? i don't want transformed, instead want appear flat 2d label faces photographic camera , remains same size on screen @ times. however, if hidden behind want appear hidden. first, should...

Do I have to use "Visual" C++ in VS 2008? -

Do I have to use "Visual" C++ in VS 2008? - i new visual studio 2008 (.net framework 3.5) , developing windows form application. starting ide, options new project under categories: visual basic visual c# visual c++ i did visual c++ -> clr -> windows forms application however, template code in "visual c++" syntx. how create new gui project plain vanilla c/c++ using visual studio 2008? please note, lastly time did mfc in visual studio c++ 6.0 if missing underlying principal please explain. thank you! example: http://msdn.microsoft.com/en-us/library/ms235634%28v=vs.90%29.aspx long story short - cannot. windows forms .net framework , not c++ framework. in turn means cannot utilize c++ work it. microsoft did invented own language c++-ish, compiles cli bytecode (likely native code mix-in, not sure). before "managed c++", c++/cli (what have linked illustration not c++, c++/cli). for plain c++ projects have take "...

c# - How to do a simple OR query with LINQ? -

c# - How to do a simple OR query with LINQ? - i using linq entities , i'm trying simple or query. have table called "links" , when run query want include links containing tag list of tags , links matching search term. example: var tags = new list<string> { "games", "events", "recipes" }; var searchterms = new list<string> { "hockey", "barbecue", "cheesecake", "basketball" } var links = _entitycontainer.links .where(x => x.tags.any(y => tags.contains(y.name)) .where(x => searchterms.any(y => x.title.contains(y))); note: link entity has navigation property called tags in first .where() i'm checking each of tags in link's collection see if list of tags i'm searching contains 1 of them. in sec .where() i'm checking if link's title property contains of search terms. my problem code includes links contain @ t...

php - ColorBox iframe - requested url /undefined not found on the server -

php - ColorBox iframe - requested url /undefined not found on the server - i've been trying add together latest colorbox jquery plugin site i'm building, , every time seek load url in ifrae popup next message displayed within iframe (the frame generates - cannot sem pull in content): >not found > >the requested url /myfolder/undefined not found on server. i have tried links found locally (e.g. info_page.php) , external links (e.g. http://www.google.com). cannot figure out why isn't loading, code lifted straight colorbox examples. my html (in head) is: <!--colorbox--> <link rel="stylesheet" href="css/colorbox.css" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script> <script src="javascript/jquery.colorbox.js"></script> <script> $(document).ready(function(){ //examples of how assign colorbox...

asp.net mvc - How to access item data in Javascript, if my Model is a QueryTable in MVC3? -

asp.net mvc - How to access item data in Javascript, if my Model is a QueryTable in MVC3? - i new mvc. found site helpful. i've been struggling model info accessing javascript. here question. i know if controller homecoming single item, can utilize <%: model.name%> in <script> section. but case there more items in model, <%foreach (var item in model) %> not work in <script> works in other part of view. can shed me lite on this? also recommend book on mvc, , razor? it helpful know more model class. likely, have class kind of collection: public class collegecourse { public string professor {get;set;}; public list<student> students {get;set;}; } you can loop through collection in server-side code this: <% foreach (var pupil in model.students) %> as far javascript... illustration gave illustration of how loop through list<t> , build html on server side. time page loads in browser, model ...

android - how to find out activity doing an Action -

android - how to find out activity doing an Action - i perfroming various actions action_send createchooser. know activity user actualy used action. way can see own custom action_chooser style dialog. wondering if there simple alternative e.g. possible find out previous activity when user gose activity? is possible find out previous activity when user gose activity? no, sorry. either create own chooser, or not worry app user chooses. android android-intent action

phpmyadmin - Xampp mysql administration page error -

phpmyadmin - Xampp mysql administration page error - i installed latest stable xampp package, , received next error page when tried access mysql administration page. i haven't been able find documentation of particular problem on several guides, , mysql's configuration file, my.cnf not appear in same place when installed xampp. there instance of mysql service running. if on windows: go local services: can run services.msc scroll downwards till see mysql, right click , click stop on context menu appears. restart xammp , run phpmyadmin again. mysql phpmyadmin xampp

android - Why the base class onReceive() function doesn't call the onUpdate()? -

android - Why the base class onReceive() function doesn't call the onUpdate()? - i have simple home screen widget application shows toast on button click. on fortunately display toast on power-up (or after update apk in emulator). button click has pending intent send action_appwidget_update onreceive() function of base of operations class doesn't handle it. here's code: public class wordwidget extends appwidgetprovider { @override public void onreceive(context ctxt, intent intent) { log.d("wordwidget.onreceive", "onreceive"); log.d("wordwidget.onreceive", intent.getaction()); if (intent.getaction()==null) { ctxt.startservice(new intent(ctxt, updateservice.class)); } else { super.onreceive(ctxt, intent); } } @override public void onupdate(context context, appwidgetmanager appwidgetmanager, int[] appwidgetids) { // prevent anr timeouts, per...

c++ - Message passing between two programs -

c++ - Message passing between two programs - currently have 2 standalone c++ programs, master , slave. master writes info shared memory, using boost::interprocess , , launches slave, able read memory. what have slave running, , master send message slave when memory has been written , ready read from. the way can think accomplish same thing slave check shared memory presence of object, , when detected read , delete it. however, doesn't seem optimal. is there nicer way of achieving same thing? background: continuation of previous question here... you can utilize posix message queues, or improve yet boost message queues. c++ shared-memory message-passing boost-interprocess

c# - How to set a string to an enum variable? -

c# - How to set a string to an enum variable? - possible duplicate: cast string enum enum attribute i have enum this: public enum iddfiltercomparetocurrent { [stringvalue("ignore")] ignore, [stringvalue("pre-post")] prepost, [stringvalue("custom")] custom } i have domainupdown controls filled same values of enum defined, exept because enum not take - character, had utilize attributes match them domainupdown contents. now question how can insert selected item of domainupdown variable of enum type? something like: private iddfiltercomparetocurrent myenum = enum.parse(typeof(iddfiltercomparetocurrent), domainupdown1.selecteditem.tostring()); i error: cannot implicitly convert type 'object' 'filtering.iddfiltercomparetocurrent'. explicit conversion exists (are missing cast?) do this: private iddfiltercomparetocurrent myenum = (iddfiltercomparetocurrent )enum.parse(t...

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter - i'm having problem expect_call method, when trying : boost::program_options::variables_map vm; mymock mock; expect_call(mock, mymethod(vm)).willonce(return(l"")); mymethod looks : std::wstring mymethod(const boost::program_options::variables_map &vm) when compiling got errors : error 17 error c2676: binary '==' : 'const boost::program_options::variable_value' not define operator or conversion type acceptable predefined operator c:\program files (x86)\microsoft visual studio 9.0\vc\include\utility error 10 error c2784: 'bool std::operator ==(const _elem *,const std::basic_string<_elem,_traits,_alloc> &)' : not deduce template argument 'const _elem *' 'const boost::program_options::variable_value' c:\program files (x86)\microsoft visual studio 9.0\vc\include\u...

ios - Build installed but it won't open, iphone/ipad during development -

ios - Build installed but it won't open, iphone/ipad during development - i had installed app in development when open app shows splash screen , after application closes. can please allow me know issue this? i using ipad2 version 5.0.1 (9a405). sounds watchdog error. you're spending much time in applicationdidfinishlaunchingwithoptions: os closing application. 5-10 seconds launch, , after forcefulness closed. should optimise launch. ios

.net - How to use templates with C++/CLI 2010? -

.net - How to use templates with C++/CLI 2010? - i've got next method in c#: public static t[] getresult<t>(ulong taskid) { homecoming getresult(taskid).cast<t>().toarray(); } and i'm trying utilize in managed c++ 2010 this: array<urlinfo^>^ arr=scheduler::getresult<urlinfo>(taskid); where i'm getting error 3 error c2770: invalid explicit generic argument(s) 'cli::array<type,dimension> what doing wrong? if urlinfo value type, don't want ^ . try array<urlinfo>^ arr if urlinfo reference type, need ^ when calling getresult . arr=scheduler::getresult<urlinfo^>(taskid); either way something's wrong. based on error message, think it's first case. .net c++-cli visual-c++-2010

Asp.Net MVC3 Razor submit calling method -

Asp.Net MVC3 Razor submit calling method - hello, i'm new mvc, have next view @model meterprofiledata.core.dto.cdapidto @{ viewbag.title = "create"; layout = "~/views/sitemaster.cshtml"; } <h2>create</h2> @using (html.beginform()) { <fieldset> <legend>add new cdapi</legend> <div class="editor-label"> @html.labelfor(model => model.name) </div> <div class="editor-field"> @html.editorfor(model => model.name) @html.validationmessagefor(model => model.name) </div> <div class="editor-label"> @html.labelfor(model => model.url) </div> <div class="editor-field"> @html.editorfor(model => model.url) @html.validationmessagefor(model => model.url) </div> <p> ...

Android SMS Receiver / Handler -

Android SMS Receiver / Handler - i want inquire if knows or have working sms receiver / handler code android. because i've been searching net days , still haven't seen updated code, seem have deprecated codes on them 1 here http://mobiforge.com/developing/story/sms-messaging-android appreciate if teach me new codes receiving sms in application. thanks! i've implemented working broadcastreceiver handle sms messages. key parts manifest , broadcastreceiver. in manifest need receive_sms permission: <uses-permission android:name="android.permission.receive_sms" /> you don't need read_sms. receiver entry should this: <receiver android:name=".incomingsmsbroadcastreceiver" android:enabled="true" android:exported="true"> <intent-filter> <action android:name="android.provider.telephony.sms_received" /> </intent-filter> </receiver> the bit pe...

pywin32 - saving excel file as tab-delimited text file without quotes -

pywin32 - saving excel file as tab-delimited text file without quotes - i have excel 2010 workbook. need save used range of each of worksheets tab-delimited text file no quotes, same filename workbook , extension given worksheet name. note excel stupidly surrounds value quotes whenever sees comma, though delimiter tab; other that, normal "save as" / "text (tab delimited)" fine. i prefer using vba code within excel. if there python solution, i'd interested too. @ point pywin32 back upwards python 3 experimental, not sure can utilize it. ok here complex routine wrote couple of months 1 of clients. code exports excel worksheet fixed width file without quotes. screenshots attached. sure code can made improve :) tried , tested option explicit '~~> alter relevant output filename , path const stroutputfile string = "c:\output.csv" sub sample() dim ws worksheet dim rng range dim myarray() long, maxlength long ...

objective c - How to let a C-array always to be accessed from disk directly instead of remaining in memory? -

objective c - How to let a C-array always to be accessed from disk directly instead of remaining in memory? - i'm trying embed binary media resources source code. going utilize plain c-array ( char[] ) store binary. (with this: embedding binary blobs using gcc mingw) because managing media files resource separately annoying work because symbol hard determined @ compile time, , makes customers annoying too. anyway i'm concerning memory consuming. if store png image, actually, don't need persistent binary anymore after loaded live image instance ( uiimage* ) it. think persistent binary remain in memory because it's part of code and it's constant. i don't know alternative remove memory. how can let c-array accessed disk straight instead of remaining in memory? ps. can limit build , execution environment strictly. utilize clang , programme run on ios. anyway don't mind utilize of build tool :) i don't understand saying or trying...

iphone - Why is object not dealloc'ed when using ARC + NSZombieEnabled -

iphone - Why is object not dealloc'ed when using ARC + NSZombieEnabled - i converted app arc , noticed object alloc'ed in 1 of view controllers not beingness dealloc'ed when view controller dealloc'ed. took while figure out why. have enable zombie objects on project while debugging , turned out cause. consider next app logic: 1) users invokes action in rootviewcontroller causes secondaryviewcontroller created , presented via presentmodalviewcontroller:animated . 2) secondaryviewcontroller contains actionscontroller nsobject subclass. 3) actionscontroller observes notification via nsnotificationcenter when initialized , stops observing when dealloc'ed. 4) user dismisses secondaryviewcontroller homecoming rootviewcontroller . with enable zombie objects turned off, above works fine, objects deallocated. enable zombie objects on actionscontroller not deallocated though secondaryviewcontroller deallocated. this caused problems in app b/c nsn...

c# - How to show cursor immediately on app startup? -

c# - How to show cursor immediately on app startup? - my app takes bit start because ui pretty heavy. want show cursors.appwaiting cursor moment user double-clicks on shortcut. pop cursor.current = cursors.appstarting; constructor of main form. however, when start app, cursor not alter until after form loaded. is there way alter cursor after user double-clicks shortcut? well, can work using background worker , usewaitcursor property alter cursor. var bw = new backgroundworker(); usewaitcursor = true; bw.dowork += (s, e) => { //do work.. }; bw.runworkercompleted += (s, e) => { invoke((action)(() => usewaitcursor = false)); }; bw.runworkerasync(); c# winforms user-interface .net-4.0 cursor

php - Extreme number of open connections between Web and DB server -

php - Extreme number of open connections between Web and DB server - i run 2 servers, 1 web (nginx/php), 1 database (mysql). nginx has 1500 active processes per second, , mysql status shows 15 alternative connections on average. now today started running: netstat -npt | awk '{print $5}' | grep -v "ffff\|127\.0\.0\.1" | awk -f ':' '{print $1}' | sort -n | uniq -c | sort -n this showed there on 7000 active connections webserver database server ip. seems kind of extreme. not utilize persistent connections in php connect mysql. i tried using mysql_close() also, seems create no difference. on webserver netstat shows on 7000 connections database server on database server netstat shows 300 connections web server any thought why there many open connections? try checking established connections only: netstat -npt | grep established | awk ... php mysql centos

c# - awaitable lambdas -

c# - awaitable lambdas - dynamic evaluations in key listener public class keyupper { func<key, bool> _evaluate; public void registerevaluator(func<key, bool> evaluate){ _evaluate = evaluate; } public void keyup(object sender, keyeventargs e){ if (_evaluate(e.keycode)) someresponse(); } public void someresponse(){ // ... } } this lambda should await on each line keyupper.registerevaluator(key => { if (key == key.a) if (key == key.w) if (key == key.a) homecoming true; } ); i.e. client code provide series of evaluations on same key argument expectation each line of evaluation awaited someresponse() invoked after sequence of keyup events of 1:a 2:w 3:a obviously @ moment never happen because method run until end , key == key.w never true it may not possible, there way create method invocation automagically homecoming next line if evaluates ...

java - Spring Security 3.1.0 - Cannot switch from HTTPS to HTTP -

java - Spring Security 3.1.0 - Cannot switch from HTTPS to HTTP - i new spring security, made little webapp in order seek , find configuration useful project working on. forcing login page accessed via https, , need switch http after logging in. in other words: login page: https only other pages: http only i tried several ways cannot create work said above. read spring security faq , see there no "natural" way of doing want, have been asked so, hence need workaround cannot find myself. i using spring security 3.1.0. web container tomcat 6.0.33. this spring security configuration: class="lang-xml prettyprint-override"> <?xml version="1.0" encoding="utf-8"?> <beans xmlns:sec="http://www.springframework.org/schema/security" xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.springframework....

While loop to retrieve input, not working correct in C -

While loop to retrieve input, not working correct in C - i have problem when using user input method allow validates input. require homecoming input after been validated. char* getvalidinputnumber(int length, char prompt[],int base) { char* user_input = calloc(length+1,sizeof(char)); fflush(stdin); fflush(file *); /*prompts & gets users input , saves in user_input*/ { printf("\n %s", prompt); fgets(user_input,length+1,stdin); /*printf("\n##entered %s : ", user_input);*/ } while(!isnumeric(user_input,base) && strlen(user_input) != length); fflush(stdin); return(user_input); } when calling function within main like.... while (strcmp(user_input,"00000000") != 0) { user_input = getvalidinputnumber(8, "enter hex value",16); } it next ... enter hex value enter hex value twice rather 1 time...

wpf - How to update the UI using bindings -

wpf - How to update the UI using bindings - i have datagrid , 2 listboxes in window. using entity framework connect sql server. depending on selections create in listboxes parameters passed stored procedure , info datagrid retrieved. able implement functionality without using mvvm. know ways implement using mvvm. please help me out. in advance. first of all, mvvm separating concerns of code appropriate area. example, talking database via ef should done in model1. viewmodel responsible holding data, , shaping or massaging create more suitable display (i.e. transforming enums colors2, etc). to implement functionality in mvvm way, need utilize binding, , bind viewmodel view: <mycontrol> <layoutroot> <listbox itemssource={binding myitems} selecteditem={binding myselection} /> </layoutroot> </mycontrol> in code behind view: public class mycontrol { public mycontrol() { this.datacontext = new myviewmode...

Using C++ Boost's Graph Library -

Using C++ Boost's Graph Library - i confused how create graph using boost library, have looked @ illustration code , there no comments explaining does. how create graph, , add together vertices , edges go? here's simple example, using adjacency list , executing topological sort: #include <iostream> #include <deque> #include <iterator> #include "boost/graph/adjacency_list.hpp" #include "boost/graph/topological_sort.hpp" int main() { // create n adjacency list, add together vertices. boost::adjacency_list<> g(num tasks); boost::add_vertex(0, g); boost::add_vertex(1, g); boost::add_vertex(2, g); boost::add_vertex(3, g); boost::add_vertex(4, g); boost::add_vertex(5, g); boost::add_vertex(6, g); // add together edges between vertices. boost::add_edge(0, 3, g); boost::add_edge(1, 3, g); boost::add_edge(1, 4, g); boost::add_edge(2, 1, g); boost::add_edge(3, ...

jquery - Trigger a button on page load -

jquery - Trigger a button on page load - i have function $("a#<?php echo $custom_jq_settings['toggle']; ?>").click(function() { jquery("#<?php echo $custom_jq_settings['div']; ?>").slidetoggle(400); jquery("#featurepagination").toggle(); jquery("#featuretitlewrapper").toggle(); homecoming false; }); and button want trigger on page load <a href="#" id="featuretoggle" onclick="changetext('<?php if (is_front_page()) {?>show<?php } else { ?>show<?php } ?> features');"><?php if (is_front_page()) {?>hide<?php } else { ?>hide<?php } ?> features</a> i trigger button when page loads starts open slides/closes does not work? <script> jquery(function(){ jquery('#featuretoggle').click(); }); </script> jquery button triggers toggle slide

javascript - opening accordion with hash tag -

javascript - opening accordion with hash tag - i trying open accordion based on url hash tag. i've found similar responses each utilize different accordion. the html script follows: <div class="contractable"> <div class="header"> <h1>branding</h1> <a class="contracttrigger" href="#branded"></a> </div> <div id="branded" class="content"> <div class="spacing"> <p>text</p> </div> </div> </div> and js is: $(function() { $('.contractable').each(function() { // natural height. var $contractable = $(this); var naturalheight = $contractable.height(); $contractable.data('naturalheight', naturalheight); // set default properties. $contractable.fin...

mysql - sqlite query to get 1 table row but grouping based on other table -

mysql - sqlite query to get 1 table row but grouping based on other table - i developing application need query sqlite database. "team" table teamid, teamname 1, eagle 2, tiger 3, snake 4, lion "member" table memberid, teamid, membername, membergender 1, 1, yuli, f 2, 2, george, m 3, 3, rudy, f 4, 4, mike, m 5, 1, susi, f 6, 2, michael, m 7, 1, lisa, f 8, 3, john, m 9, 4, linda, f 10, 4, torry, m 11, 2, jessica, f 12, 2, abba, f requirement : 1. show "member" table 2. list need grouped teamid 3. if in team there "male" set team on top (first) * team not have "male" set on bottom (last) 4. grouping sorted teamid * fellow member of same teamid must listed in sequence ordered the expected ho...

tsql - Add Year Prefix in auto generated id which is a primary key -

tsql - Add Year Prefix in auto generated id which is a primary key - i want id autogenerated , want format this: 12-0001, 12-0002 12 represent year 2012 current year of scheme date. and lastly record id 12-0999 , when 2013 comes want id alter year prefix , reset 4 digit this: 13-0001, 13-0002. i'm using asp.net mvc 3 , sql server express 2008. can tell me of way can this. i see 2 options: (1) if table you're inserting info has date or datetime column has "right" year in it, add together persisted, computed column table - like: alter table dbo.yourtable add together pkid right(cast(year(datecolumn) char(4)), 2) + '-' + right('00000' + cast(id varchar(5)), 5) persisted assuming id int identity column autogenerates sequential numbers, , want phone call new column pkid (change needed). since persisted computed column, it's computed 1 time - when row inserted - , can indexed , used pri...

unit testing - How to force an exception in JPA when executing a joinTransaction() or commit()? -

unit testing - How to force an exception in JPA when executing a joinTransaction() or commit()? - for testing database related code using jpa using in-memory database such hsqldb: how can forcefulness exception raised when executing entitymanager.jointransaction() or entitymanager.gettransaction().commit() ? i'd forcefulness exception without altering tables database (ex. deleting table test perform persist() ). some ways, shutdown database violate foreign key or unique constraint for jointransaction() i'm not sure much, joins jta transaction. throw error if not in jta transaction, or potentially in transaction, or resource_local. unit-testing exception java-ee jpa

android - Restart app on force kill -

android - Restart app on force kill - i got geolocation service. when forcefulness killed using task killing apps, in 'manage application' -> running tab app showing 0 process , 1 service, , status restarting, not getting restarted. public int onstartcommand(intent intent, int flags, int startid) { homecoming start_redeliver_intent; } i started service using startservice(new intent(this, myservice.class)); is there way restart process? use return start_sticky instead. android background-service

ios - Compute right Zoom/Span for MkPolyline overlay -

ios - Compute right Zoom/Span for MkPolyline overlay - hi seek compute right zoom/span mkpolyline, work () it's not closer... this method : -(void)showpathforindex:(int)index{ //calculate new part show on map double center_long = 0.0f; double center_lat = 0.0f; double max_long = 0.0f; double min_long = 0.0f; double max_lat = 0.0f; double min_lat = 0.0f; (cllocation *cll in [[self.routes objectatindex:index]coordinates]) { //find maximum & minimum value if (cll.coordinate.latitude > max_lat) { max_lat = cll.coordinate.latitude; } if (cll.coordinate.latitude < min_lat){ min_lat = cll.coordinate.latitude; } if (cll.coordinate.longitude > max_long) { max_long = cll.coordinate.longitude; } if (cll.coordinate.longitude < min_long) { min_long = cll.coordinate.longitude; } center_lat = center_lat + cll.coordinate.latitude; center_long = center_long + cll.coordinate.longitude; } //cal...

Can a Linux process block external signals but accept signals from its own process? -

Can a Linux process block external signals but accept signals from its own process? - i trying setup linux process, blocks sigterm sent kill command (or other process), allows sigterm sent within (through kill(2) scheme call). is possible? here illustration programme wrote, sig_blocks both external , internal signals, doesn't want: #include <signal.h> #include <unistd.h> #include <stdio.h> int main(int argc, char **argv) { sigset_t sigs; sigemptyset(&sigs); sigaddset(&sigs, sigterm); sigprocmask(sig_block, &sigs, 0); printf("sleeping 30 secs, seek killing me! (pid: %d)\n", getpid()); sleep(30); printf("about phone call kill\n"); kill(getpid(), sigterm); printf("this never happens!\n"); homecoming 1; } the output is: sleeping 30 secs, seek killing me! (pid: 29416) phone call kill never happens! but should be: sleeping 30 secs, seek killing me! (pid: 29416) phone...

c# - Profiling Azure in the Compute Emulator -

c# - Profiling Azure in the Compute Emulator - i'm having issue when stop azure project , @ random other times, starts consuming massive amounts of memory , uses available ram. i can't seem figure out how profile project in compute emulator. know can profile in cloud, issue occurs in emulator. aware emulator doesn't accurately model cloud, etc. etc., still want utilize emulator , need project work in without chewing memory. can allow me know how profile while running in emulator? one alternative utilize different tool profiler, example, utilize perfview profiler released: http://blogs.msdn.com/b/vancem/archive/2011/12/28/publication-of-the-perfview-performance-analysis-tool.aspx c# .net azure profiling azure-compute-emulator

ios - What's the proper way to replace a UIViewController with a UITableController without a navigation controller stack? -

ios - What's the proper way to replace a UIViewController with a UITableController without a navigation controller stack? - assuming start blank project, , add together 2 views (uiviewcontroller,uitablecontroller). what's proper way jump uiviewcontroller uitablecontroller without navigation controller stack? ex: think of welcome page, click here continue, , takes table controller. thanks! if these view controllers, can reassigning rootviewcontroller property of uiwindow set whichever controller want display, , rest. ios uiviewcontroller

objective c - Run HTML scripts in Cocoa-Touch? -

objective c - Run HTML scripts in Cocoa-Touch? - is there way run html scripts in ios application? want send email using script when uiswitch on, because have send encoded info not want user accidentally modify. have alternative in app preferences allow users send debugging info me can prepare app, kind of adobe did in mobile photoshop app. best way can think of doing utilize html script below: <a href="mailto: subject= &body="></a> also, app rejected if include that? take @ mfmailcomposeviewcontroller: http://developer.apple.com/library/ios/documentation/messageui/reference/mfmailcomposeviewcontroller_class/reference/reference.html and send debug info attachment (addattachmentdata:mimetype:filename:) user can't modify it. user can't modify attachments, delete them, warn user not delete attachment. using html link still open mail service app , allow user edit message before sending. html objective-c cocoa-touch

reflection - Convert c# by-reference type to the matching non-by-reference type -

reflection - Convert c# by-reference type to the matching non-by-reference type - i examine parameters of c# method using reflection. method has out parameters , these types, have isbyref=true. illustration if parameter declared "out string xxx", parameter has type system.string&. there way convert system.string& system.string? solution should of course of study not work system.string type. use type.getelementtype() . demo: using system; using system.reflection; class test { public void foo(ref string x) { } static void main() { methodinfo method = typeof(test).getmethod("foo"); type stringbyref = method.getparameters()[0].parametertype; console.writeline(stringbyref); type normalstring = stringbyref.getelementtype(); console.writeline(normalstring); } } c# reflection

class - How to determine the structure of an iOS (id) object? -

class - How to determine the structure of an iOS (id) object? - when phone call function ios app, returns id info type. can't see function don't know it's doing or homecoming type is. if print console using nslog("@"...) string similar this: 2012-01-18 19:03:08.915 helloworld[165:707] key press state . is there way me determine construction of basic id object? how go getting specific part of response out, such "key press state" . string parsing seems horrible idea, maybe that's way. perhaps info nsstring ? thanks! try this: nslog(@"mystery object %@", nsstringfromclass([mysteryobject class])); ios class casting nsstring nslog

Django - Can't remove empty_label from TypedChoiceField -

Django - Can't remove empty_label from TypedChoiceField - i have field in model: types_choices = ( (0, _(u'worker')), (1, _(u'owner')), ) worker_type = models.positivesmallintegerfield(max_length=2, choices=types_choices) when utilize in modelform has "---------" empty value. it's typedchoicefield hasn't empty_label attribute., can't override in form init method. is there way remove "---------"? that method doesn't work too: def __init__(self, *args, **kwargs): super(jobopinionform, self).__init__(*args, **kwargs) if self.fields['worker_type'].choices[0][0] == '': del self.fields['worker_type'].choices[0] edit: i managed create work in way: def __init__(self, *args, **kwargs): super(jobopinionform, self).__init__(*args, **kwargs) if self.fields['worker_type'].choices[0][0] == '': worker_choices = self.fields[...

c# - Sync Framework, filter fake deleted rows -

c# - Sync Framework, filter fake deleted rows - context: want synchronize sql server sql compact trough wcf. client (sqlce) downloads updates server(sql2008) time time. on server nil gets ever deleted it's marked "deleted" (more version == minvalue means it's deleted), problem: don't want clients have deleted items in db. when item both on server , client, marked deleted (version=minvalue) want item deleted client not marked do think scenarios possible sync framework , filters ? you need setup filters in wcf service. unfortunately, cannot recall details. c# sql synchronization microsoft-sync-framework

asp.net mvc - What to return from service to ASP MVC web app? -

asp.net mvc - What to return from service to ASP MVC web app? - right have asp mvc web application along models project, service project, utilities project, , few datastores projects function repository 1 or more domain models. i'm pretty happy separation of each layer i'm stuck on homecoming service layer web app. for example, when user seek register, registerviewmodel received controller. individual pieces (email, password, etc.) send service layer build fellow member domain object guid, status, createdate, etc., send repository storage , homecoming fellow member object web app redirect /member/{guid}. but how should service layer inform web app if email exists? in more complex situation may have check existence/validity of multiple domain objects , business rules have homecoming multiple errors in 1 go. in addition, don't want exception bubble web layer service layer traps exceptions need notify web layer how. even if find way homecoming that, web laye...

c++ - How to check if the program is run from a console? -

c++ - How to check if the program is run from a console? - i'm writing application dumps diagnostics standard output. i'd have application work way: if run standalone command prompt (via cmd.exe ) or has standard output redirected/piped file, exit cleanly finished, otherwise (if run window , console window spawned automagically), additionally wait keypress before exiting (to allow user read diagnostics) before window disappears how create distinction? i suspect examining parent process way i'm not winapi, hence question. i'm on mingw gcc. you can utilize getconsolewindow, getwindowthreadprocessid , getcurrentprocessid methods. 1) first must retrieve current handle of console window using getconsolewindow function. 2) process owner of handle of console window. 3) compare returned pid against pid of application. check sample (vs c++) #include "stdafx.h" #include <iostream> using namespace std; #if _win32_winnt ...

javascript - Scroll a HTML div if height changes -

javascript - Scroll a HTML div if height changes - using javascript how can scroll html div if height of div changes? in below code if mychat's height changes need chat div's scroll bar should come down. javascript wrong can right please. my code is <style type="text/css"> #chat { height:250px; width:200px; overflow:auto; background-color:aqua; padding:5px; } </style> <script type="text/javascript"> function show() { var mydiv = document.getelementbyid('mychat'); var mydiv2 = document.getelementbyid('chat'); var sval; if(mydiv.clientheight != sval) { mydiv2.scrolltop = mydiv2.scrollheight; } sval = mydiv.clientheight; } </script> <asp:scriptmanager id="scriptmanager1" runat="s...

Magento: which table should be used in the following code? -

Magento: which table should be used in the following code? - i read article http://inchoo.net/ecommerce/magento/how-to-add-new-custom-category-attribute-in-magento/comment-page-1/ there part of code in installer: //this set info of custom attribute root category mage::getmodel('catalog/category') ->load(1) ->setimportedcatid(0) ->setinitialsetupflag(true) ->save(); //this set info of custom attribute default category mage::getmodel('catalog/category') ->load(2) ->setimportedcatid(0) ->setinitialsetupflag(true) ->save(); two question here: function load has parameter. id. which table should used for? what setimportedcatid here? it's setter, don't understad for. magento categories still utilize eav table structure, table you're interested in catalog_category_entity however, won't able see category names here. info category objects persisted to catalog_category...

php - How to open an Excel file with PHPExcel for both reading and writing? -

php - How to open an Excel file with PHPExcel for both reading and writing? - i'm using phpexcel library, , i'm creating xls objects either writing or reading: phpexcel_iofactory::createreaderforfile('file.xlsx') phpexcel_iofactory::createwriter('excel2007') how can open xlsx file reading , writing? you load file phpexcel using reader , load() method, save file using author , save() method... phpexcel unaware of source of phpexcel object... doesn't care whether have loaded file (or type of file) or created hand. as such, there no concept of "opening read/write". read file name, , save same filename. overwrite original file changes have made in script. edit example error_reporting(e_all); set_time_limit(0); date_default_timezone_set('europe/london'); set_include_path(get_include_path() . path_separator . './classes/'); include 'phpexcel/iofactory.php'; $filetype = 'excel5'; $filename ...

java.lang.NoSuchMethodError: org.hibernate.SessionFactory.openSession()Lorg/hibernate/classic/Session -

java.lang.NoSuchMethodError: org.hibernate.SessionFactory.openSession()Lorg/hibernate/classic/Session - i trying integrate working spring project hibernate, error getting on start up. evere: servlet.service() servlet [appservlet] in context path [/telephonedirectory] threw exception [handler processing failed; nested exception java.lang.nosuchmethoderror: org.hibernate.sessionfactory.opensession()lorg/hibernate/classic/session;] root cause java.lang.nosuchmethoderror: org.hibernate.sessionfactory.opensession()lorg/hibernate/classic/session; @ org.springframework.orm.hibernate3.sessionfactoryutils.dogetsession(sessionfactoryutils.java:322) @ org.springframework.orm.hibernate3.sessionfactoryutils.getsession(sessionfactoryutils.java:233) @ org.springframework.orm.hibernate3.hibernatetemplate.getsession(hibernatetemplate.java:457) @ org.springframework.orm.hibernate3.hibernatetemplate.doexecute(hibernatetemplate.java:393) @ org.springframework.orm.hibernate3.hib...

javascript - Adding background img if screen resolution width >1028 -

javascript - Adding background img if screen resolution width >1028 - hi guys, i'm new javascript. have pretty simple script wrote add together background image if screen resolution width bigger 1028px. unfortunately, after trying (on computer, 800x600 resolution), doesn't work. i'm not looking stretch image, add together if screen resolution width bigger or equal 1024. here code: <script language="javascript"> <!-- document.write('<style type="text/css">div#container_header_body {background-image:url(\''); if (screen.width<1024) { document.write('none;'); } else { document.write('images/mmmgirl.png'); } document.write('\');</style>'); //--> </script> <link rel="stylesheet" type="text/css" href="stylesheet.css" /> can give me insight i'm doing wrong? thanks m...

logging - MySQL: Slow log; append CPU usage -

logging - MySQL: Slow log; append CPU usage - i have mysql slow log feature enabled: http://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html but query_times high due high cpu load. how can append current cpu load each entry in mysql slow log (it writes file)? the cpu may high due slow query. mysql not monitor cpu, going need 3rd party monitoring tool , compare times cpu high times query (that logged) running. i utilize aws, has nice monitoring, , alert when cpu high, can tail slow query log , see ones causing it. hope helps some. guess cpu high due query , not query slow due cpu. guess tho. mysql logging cpu-usage

c# - Understanding how queue/stack class works and figuring out why this code isn't working -

c# - Understanding how queue/stack class works and figuring out why this code isn't working - the first foreach method gets several errors. can't figure out why , seems should work... foreach - invalid token 'foreach' in class, struct, or interface fellow member declaration. this prints out 1 2 3 4 1 2 3 4 1 2 3 4. the 2nd foreach method. how work? think iterates through each number 1 @ time in order. confusion comes in same code, stack instead of queue. 2nd foreach prints out 4 3 2 1. why this? namespace cards { class class1 { queue numbers = new queue(); foreach (int number in new int[4]{1,2,3,4}) { numbers.enqueue(number); console.writeline(number + " has joined queue"); } foreach (int number in numbers) { console.writeline(number); } while(numbers.count > 0) { int number = (int)numbers.dequeue(); ...

c# - Which technology to use for running crawler and updating database in asp.net website? -

c# - Which technology to use for running crawler and updating database in asp.net website? - i developing project college , need suggestions on development. website shows info other websites links, images etc. i have prepared below given model website. a home.aspx page shows info tables (sql server). i have coded crawler (in c#) can crawl (fetch data) required website data. i want way through can run crawler @ end time interval , can insert updates in tables. want can updated info in database home.aspx shows updated info. (its smaller version of google news website) i want host wesbite in shared hosted environment (i.e 3rd party hosting provider company , may utilize iis platform) i posted simliar situation different .net forums , communities , suggested lot of different things such as create web service (is necessary ?) use wcf create console application , run windows task sheduler (is okay asp.net (win forms website) , in shared hosted) run crawler on loca...