Posts

Showing posts from June, 2010

c# - Move local mssql database to webhosted MYSQL -

c# - Move local mssql database to webhosted MYSQL - i'm dektop developer , don't know much how webhosting work... please help me here. currently app works mssql database installed locally on same machine. need go wider , allow multiple apps work same database on internet. have webhosting cpanel in , mysql database. please tell me how can access tables in mysql database computers? select , update records in table. have implement functionality using php create such requests? please advise.. exporting raw ms-sql dumps not work if seek import mysql because there differences in syntax. there commercial programs available help migrate data, otherwise might improve code php programme export mssql mysql. but question sounds more you're asking how access databases remotely. . php can natively. when create link database specify host. example: $databaseconnection = new mysqli('username','password','host_ip_address'); if you're...

mysql - group by ratio and seniority list IN SQL -

mysql - group by ratio and seniority list IN SQL - i working on mysql, , looking solution show info grouping ratio. i have course table contain courses id , courses ratio. have table, ask , contain askers id, , field course of study id pointing on course table (ids correspond). 1 sql query, display asks grouping ratio , rejecting other demands. demands considered seniority list. by example, have 3 courses: first 1 allow 2 people , 2 other courses allow 1 person. in inquire table, have 3 askers (jack, joe , john) pointing on first course, (john , joe) 2 on sec , 3rd (jack , john). jack older, after john , after joe. i see: course id studentname ------------------------- 1 jack 1 john 2 john 3 jack select c.courseid s.studentname course of study c bring together asks on a.courseid = c.courseid bring together pupil s on s.studentname = a.studentname bring...

facebook - cause an IE8 browser running in compatibility mode to run without it! -

facebook - cause an IE8 browser running in compatibility mode to run without it! - this quite frustrating, saw many questions around topic, strangely plenty non seem address issue. i have facebook application works great in ie8. thing is, runs within iframe, means facebook causes browser render in ie compatibility mode, while application wants run simple ie8. the meta tag http-equiv="x-ua-compatible" doesn't seem have influence. what can do? thank you the problem iframe inherits parents' compatibility mode no matter in html of iframe. so, reply is, thing can create sure html , styles work fine in ie7 in case. facebook ie8-compatibility-mode

jquery autocomplete iframe as source help -

jquery autocomplete iframe as source help - hi im trying dump iframe info var in jquery , using souce, src iframe txt file \n delimiter heres code, cant seem autocomplete work, text file 50 kb , 3000-4000 lines of splitting done var info = $('#friends').contents().text().split('\n');//iframe contents $('#searchbox').autocomplete({ source: info }); $("#searchbox").bind("autocompleteselect", function (event, ui) { var profilesearchrequest = ui.item.value; localstorage.setitem('profilesearchrequest', profilesearchrequest);//just html5 localstorage here... document.location = 'user.html';//just 1 time li item on autocomplete clicked... }); <input type="text" class="ui-button-text searchbox" id="searchbox" /> <iframe src="data/nameslite.txt" id="friends" style="displa...

android - image in the footer frame of an alert dialog -

android - image in the footer frame of an alert dialog - i set image in footer frame of alert dialog. can please tell if possible, , how? know possible create custom dialog, way? have @ this, gives thought create custom alertdialog. http://android-er.blogspot.com/2011/06/custom-alertdialog.html android dialog drawable

iphone - Pushing a new viewcontroller via a next button? -

iphone - Pushing a new viewcontroller via a next button? - sorry can't show code question - should simple explain.. i have array of info (object1, object2, object3, etc)… have 1 tableview lists these objects (object1.title, object2.title, etc) , upon clicking push's viewcontroller shows detail of each object. now, rather have press on each detail view, i'd set next button on detail page.. i force new controller, end chain of: list view -> detailview1 -> detailview2, etc.. which pain traverse stack.. can parent view controller removed / changed or not best way it? cheers. you can pop specific index in stack. have button pops parent. if there no real reason user need go through detail view controllers swap controllers replacing stack new stack using setviewcontrollers:animated: through uinavigationcontroller documentation , see whats possible. iphone uitableview uiview uiviewcontroller

bash - \r not working in awk's printf? -

bash - \r not working in awk's printf? - found script googling, has progress bar cp, problem creates tons of lines, this: 0% [=> 0% [=> 0% [=> 0% [=> 0% [=> 0% [=> 0% [=> 0% [=> 0% [=> 0% [=> 0% [=> 1% [==> 1% [==> 1% [==> 1% [==> 1% [==> 1% [==> 1% [==> 1% [==> 1% [==> 1% [==> 1% [==> 1% [==> 1% [==> 1% [==> 1% [==> here script's code: #!/bin/bash strace -q -ewrite cp -- `printf '%q ' $@` 2>&1 \ | awk '{ count += $nf if (count % 10 == 0) { percent = count / total_size * 100 printf "%3d%% [", percent (i=0;i<=percent;i++) printf "=" printf ">" (i=percent;i<100;i++) printf " " printf "]\r" } ...

zend framework - Zend_Db_Table::getDefaultAdapter is not working -

zend framework - Zend_Db_Table::getDefaultAdapter is not working - hi using zend framework , in login controller index action . when user submit login form , trying defaultadapter , tried $db = zend_db_table::getdefaultadapter(); and not working . but used $db = zend_db::factory('pdo_mysql', array( 'host' => 'localhost', 'username' => 'root', 'password' => '123', 'dbname' => 'test' )); then working . this index action public function indexaction() { $loginform = new application_form_loginform(); if($this->getrequest()->getpost()) { $filter = new zend_filter_striptags(); $name = $filter->filter($th...

Emacs ,org, beamer - No definition for class `beamer' in `org-export-latex-classes' -

Emacs ,org, beamer - No definition for class `beamer' in `org-export-latex-classes' - i next tutorial, , getting error, when seek export presentation latex: no definition class `beamer' in `org-export-latex-classes' note: installed emacs repository in ubuntu. , next related packages available in system: emacs-snapshot emacs-snapshot-bin-common emacs-snapshot-common emacsen-common latex-beamer latex-xcolor preview-latex-style texlive-latex-base texlive-latex-extra texlive-latex-recommended am missing anything? have configure other things? yes., should define beamer class in org-latex-export-classes. illustration how define in blog post emacs latex org-mode beamer

gimp - Script Fu - Brightness -

gimp - Script Fu - Brightness - i wondering if knows how utilize script-fu in order have gimp read in image, modify brightness/contrast , save image. thanx look imagemagick , it's command-line tools. gimp script-fu

iphone - How to create a mobile interface for Grails apps? -

iphone - How to create a mobile interface for Grails apps? - i'd have mobile interface grails app, , wondering how go it, namely how create ui. google search revealed iui , iui grails plugin. both don't seem maintained longer, lastly releases beingness in 2009. despite version numbers, in usable state? there alternatives? remember seeing plugin this, cannot find it. right now, have iphone clients. in long run, web-app benefit vendor-neutral interface, or more prudent create interface per platform? i can suggest @ mobl-lang, jquery mobile or phonegap frontend , allow grails app deliver info frontend json iphone grails user-interface mobile grails-plugin

css - styling pop up window styling hack -

css - styling pop up window styling hack - hey can give style ready made pop website (window). suppose posting comment , blog needs register me , inquire me login social network. clicked , pop window opened yess want alter pop window style without inserting stylesheet it. thought ? css popup

linux - under mac terminal: List all of the users whom has at least one running process? -

linux - under mac terminal: List all of the users whom has at least one running process? - how list of users whom has @ to the lowest degree 1 running process. the user name should not duplicated. user name should sorted. $ ps xau | cutting -f1 -d " "| sort | uniq | tail -n +2 you may want weed out names starting _ : ps xau | cutting -f1 -d " "| sort | uniq | grep -v ^_ | tail -n +2 linux osx terminal

Can I store the output of a command in a variable in batch scripting? -

Can I store the output of a command in a variable in batch scripting? - i want dir folder , in variable names of *.csv files. does know how can this? using bash can try: dirlist=`ls -1 *.csv` echo "$dirlist" under windows can read next q , a: windows batch files: how set variable result of command? something like: for /f "delims=" %%a in ('dir') @set foobar=%%a change 'dir' want. have no windows machine close by, cannot test. batch-file

what is the need of 'require' when all one ever needs is 'require_once' in php? -

what is the need of 'require' when all one ever needs is 'require_once' in php? - hi quite new php ,so pls forgive naive question. why 1 ever need utilize require when need require_once.it great if point me out examples need utilize require , not require_once you may want include code more once. navigation, multiple times (top , bottom of page). analytics code, once. require faster since require 1 time has check file has not been included. php

tsql - SQL query to find duplicate rows, in any table -

tsql - SQL query to find duplicate rows, in any table - i'm looking schema-independent query. is, if have users table or purchases table, query should as capable of catching duplicate rows in either table without modification (other from clause, of course). i'm using t-sql, i'm guessing there should general solution. i believe should work you. maintain in mind checksum() isn't 100% perfect - it's theoretically possible false positive here (i think), otherwise can alter table name , should work: ;with cte ( select *, checksum(*) chksum, row_number() over(order getdate()) row_num my_table ) select * cte t1 inner bring together cte t2 on t2.chksum = t1.chksum , t2.row_num <> t1.row_num the row_number() needed have way of distinguishing rows. requires order by , can't constant, getdate() workaround that. simply alter table name in cte , should work without spelling out co...

asp.net - Hyperlink in MVC3 -

asp.net - Hyperlink in MVC3 - i have in mvc3 razor.. want create hyperlink..so users can click on it. right prints text of url in view.. help. <td> @html.displayfor(modelitem => item.weblink) </td> thanks richard, heres solution.. @{ var link = @item.weblink; if (link != null) { if (!link.startswith("http://")) { link = "http://"+link; } } } <a href="@link">@item.weblink</a> you should try: <a href="@item.weblink">@item.weblink</a> ok comment need this: @{ var link = @item.weblink; if (!link.startswith("http://")) { link = "http://"+link; } } <a href="@link">@item.weblink</a> asp.net asp.net-mvc asp.net-mvc-3 razor

fork - problem with creating child processes in xcode -

fork - problem with creating child processes in xcode - i trying write , debug code in xcode create several processes (which represent nodes in network) , these processes have utilize ipc's communicate. @ first getting error in msgctl, trying debug using fprintf file, when stoped creating kid processes together, wrote printf in form pid[0]=fork(); if(pid[0]==0) { printf("chicken"); } but nil prints, assuming no kid process created... know should do? thanks maybe need flush stdout, this printf("chicken"); fflush(stdout); xcode fork process pid

ruby on rails - How to test controllers with nested routes using Rspec? -

ruby on rails - How to test controllers with nested routes using Rspec? - i have 2 controllers created using scaffold generator of rails. wanted them nested in folder called "demo" , ran rails g scaffold demo/flows rails g scaffold demo/nodes then decided nest nodes within flows, , changed routes file so: namespace :demo resources :flows resources :nodes end end but alter resulted on rspec tests nodes breaking actioncontroller::routing errors. 15) demo::nodescontroller delete destroy redirects demo_nodes list failure/error: delete :destroy, :id => "1" actioncontroller::routingerror: no route matches {:id=>"1", :controller=>"demo/nodes", :action=>"destroy"} the problem rspec looking @ wrong route. it's supposed "demo/flows/1/nodes". needs mock model flow, not sure how provide that. here sample code generated rspec file: def mock_node(stubs={}) @mock_n...

elisp - How can I set up two, parallel buffers in emacs to edit Python files in one and execute in an IPython shell in the other? -

elisp - How can I set up two, parallel buffers in emacs to edit Python files in one and execute in an IPython shell in the other? - i'm trying setup ipython.el in emacs23. i've installed (after putting python-mode.el in load-path supplant python.el comes pre-installed emacs). , can run via m-x py-shell , etc. the interface seems pretty poorly setup, , wondering if doing wrong, or if need customize create work way i'd like. in short, workflow i'd have: in 1 or more buffers, edit python code when nail c-c c-c in buffer, either execute python code in buffer in open ipython shell buffer (if there one) or open buffer that. but happens right is: with ipython shell in 1 buffer , python file in other, if nail c-c c-c in python file buffer, file buffer switches ipython buffer (meaning have two, duplicated ipython buffers) , file executed. this annoying. i'm pretty new elisp, understanding of defadvice advise around python-execute-buffer take...

Ajax in Wordpress plugin -

Ajax in Wordpress plugin - i creating simple wordpress plugin , trying utilize ajax, 0 in ajax response. <script type="text/javascript" > jquery(document).ready(function($) { var info = { action: 'my_action', whatever: '1234' }; jquery.post("http://localhost/taichi/wp-admin/admin-ajax.php", data, function(response) { alert(response); }); }); </script> <?php add_action('wp_ajax_my_action', 'my_action_callback'); add_action( 'wp_ajax_nopriv_my_action', 'my_action_callback' ); function my_action_callback() { echo "test"; die(); } what doing wrong? you have set add_action @ finish bottom of file or else won't find callback function ajax wordpress plugins wordpress-plugin

winapi - Handle external windows using java -

winapi - Handle external windows using java - i need check if external window (another java program, not controlled programme i'm working on) open using title, , if open, either maximize or minimize based on user command in java (i know title of window , nil else) . google says can utilize winapi window handle , manipulate using handle, i'm not able find how this. i find references on how using jni here: in java swing how win32 window handle (hwnd) reference window?. possible without using jni? could help me understand how this. thanks , regards i've added lot of win32 related window functions jna. can see details here. // find , minimize window: windef.hwnd hwnd = user32.instance.findwindow("classname", "windowname"); user32.instance.showwindow(hwnd, winuser.sw_minimize); you can enumerate windows: final windef.hwnd[] windowhandle = new windef.hwnd[1]; user32.instance.enumwindows(new winuser.wndenumproc() { @override ...

redirect - Tomcat Host & port Configuration -

redirect - Tomcat Host & port Configuration - i have tomcat 5.5 in windows environment listening port:8080.i wanted alter hostname localhost www.mydomain.com.adding alias name in conf/server.xml & adding entry in /etc/hosts file achieved this.but have access name port number in url http://www.mydomain.com:8080/ .is there way out specifying port number in url, redirect/forward requests port 8080 if url www.mydomain.com? you should able alter in [tomcat home]/conf/server.xml (at to the lowest degree on unix-type system, should similar on win). search 8080 , alter there. tomcat redirect port hostname

ios - Core data and sorting after a join condition -

ios - Core data and sorting after a join condition - i have 3 tables in core info tables. item table: items, has id column , connection properties table. properties table: has propertyvalue column , connection item table , connection property table. property table: has propertyname column , connection properties table. the property table contains propertyname called "price". properties table contains propertyvalue "20" property "price". think can sort items table price? i using nsfetchedresultscontroller , creating nsfetchrequest it. have tried write nssortdescriptor comparator block object nsfetchrequest . isn't working. after tried write nssortdescriptor without selector or block object, setup key called "dealprice" , created category on item managed object method called - (nsstring *)dealprice . wasn't working neither. do know other method? or know solution? you've got bad case of sql fever. trying treat core ...

mysql - SQL Date between and another condition statement not working -

mysql - SQL Date between and another condition statement not working - here 2 sql query when executing sql work fine. select * xyz file_play_start_date between '2011-07-01 06:15:00' , '2011-07-08 06:30:00' ...but when adding status not working. e.i:returning no result tho there result show in condition. select * xyz calender_id = 3 , file_play_start_date between '2011-07-01 06:15:00' , '2011-07-08 06:30:00' can 1 tell me why happening? there no rows in xyz calender_id = 3 , file_play_start_date between '2011-07-01 06:15:00' , '2011-07-08 06:30:00'. mysql sql

c# - StringReader or Memory Stream which is resource friendly? -

c# - StringReader or Memory Stream which is resource friendly? - i have module responsible parsing csv info received different user via website interface, , have parse csv. considering use, textfieldparser it. but before implement considering shall improve approach... generating memorystream info received, or initialising stringreader same input string. which 1 improve & why? option 1 won't give string @ all, if want work byte array , buffers, go way seems unlikely. if you're doing string processing recommend alternative 2, because can read line @ time. as far can see reason utilize memorystream if need more complex stringreader doesn't handle want (otherwise you're reinventing wheel): encodings, unusual line formats, etc. having worked big files (specifically csv files) stringreader s, i've never had problem. i'd wager when ms designed stringreader you're trying do, made resource-friendly possible. c# vb.ne...

iphone - why isn't my original variable changed when I pass by reference a CoreData managed Object variable? -

iphone - why isn't my original variable changed when I pass by reference a CoreData managed Object variable? - why isn't original variable changed when pass reference coredata managed object variable? so have in iphone application, coredata managed object called config. 1 of variables in xcode 4 produced *.h , *.m files "@dynamic height;" (i point out because wonder if it's related this). when accessing variable in code nsnumber. so when setup new info selection view/controller set variable in controller equal height, when alter in next view & come back, should changed in 1st view (pass ref concept). only problem doesn't seem alter value? some code extracts: @interface config : nsmanagedobject { @private } @property (nonatomic, retain) nsnumber * height; @end @implementation config @dynamic height; @end calling 2nd view // prepare selectorcontroller *sc = [[selectorcontroller alloc] initwithstyle:uitableviewstylegrouped]; sc...

model - Rails: Set a private value so it only calls the database once -

model - Rails: Set a private value so it only calls the database once - i have next method check if user has admin access. def has_admin_access?(user) user.present? && gym_users.where(:role_id => [3, 4]).where(['user_id = ? , date_ended null', user.id]).any? end the problem comes when want phone call multiple times on page. how can set private value , create database phone call first time? you can store result in hash, , if same user 1 time again homecoming result hash. this: def has_admin_access?(user) @admin_hash ||= {} if (!@admin_hash.include?(user)) @admin_hash[user] = user.present? && gym_users.where(:role_id => [3, 4]).where(['user_id = ? , date_ended null', user.id]).any? end @admin_hash[user] end ruby-on-rails-3 model accessor

android - Fragments - Do you have to use an Activity Wrapper around a fragment which comprises the whole Activity? -

android - Fragments - Do you have to use an Activity Wrapper around a fragment which comprises the whole Activity? - consider sample app developers.android.com this describes using fragments so: on phone can utilize fragment 1 on activity , fragment 2 on activity b. on tablet have more real estate utilize fragment 1 , fragment 2 on activity a. great! ... but... on first illustration (the 1 phone) create activity xml file containing single <fragment> , that's all, in activity phone call setcontentview() on xml? seems lot of redundant code (activity, xml & fragment display fragment): can set fragment activity or wrapper xml required? ah, found here public class mainmenuholder extends fragmentactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // if not added fragment manager add together it. if don't new fragment added every time method called (such on...

system.reflection - Conditionally instantiate a class in C# -

system.reflection - Conditionally instantiate a class in C# - i've been busting hump trying new code work. have been able in simpler more extensive way, through if statements. however, going version 2 of application, code little cleaner , more efficient. what trying conditionally instantiate class. go this: int aeroplane = 195; if (airplane == 190) _e190 aircraft = new _e190(); else if (airplane == 195) _e195 aircraft = new _e195(); i have both classes, utilize keyword "aircraft" don't have create multiple parts of code each class. have found out multiple inheritance (which, in opinion, trick) not available in c#, , relatively new language. so far, have accomplished instantiate class way want, can't seem utilize variables declared within each class. have done this: int aeroplane = 195; var aircraft = activator.createinstance( (airplane == 195) ? typeof(_e195) : typeof(_e190)); messagebox.show(aircraft.gettype().tostrin...

.net - How do I generate and package PDB files with NPanday? -

.net - How do I generate and package PDB files with NPanday? - my coworkers , trying utilize maven build our c# .net webservice projects. after research, npanday seemed best choice. have been successful in getting npanday working nunit , local nexus artifact repository. but we're wondering if there way create , bundle .pdb files debugging (specifically because have projects depend on other internal projects). using dotnet-library packaging type npanday , doesn't appear have way of doing this. according the documentation, seem custom-lifecycle-maven-plugin need utilize in order create dotnet-symbols or dotnet-archive packages. i'm not sure how utilize it. my guess using custom-lifecycle-maven-plugin require adding our own compilation , packaging (zipping) goals similar described here: http://docs.codehaus.org/display/mavenuser/using+maven+to+manage+.net+projects doing seems remove much of simplicity of using npanday's maven-compile-plugin. can help me so...

android - Problem deploying to emulator -

android - Problem deploying to emulator - i'm experimenting first time, mono framework develop applications android. i have installed mono mac 2.10.2, monodevelop 2.6 beta 3 , trial version of monodroid. i followed tutorial helloworld, i'm having troubles when trying deploy application emulator. click 'debug', , 'select device' window appears. shows me avd images, , on bottom of each 1 says 'not started'. select avd want, click on 'start emulator' , emulator starts. problem never refreshes state emulator running , can deploy app it. if click 'refresh' list becomes empty. anyone can help me out? i'm doing wrong or bug of monodevelop? patience ;) mono 2.10.2 has bug prevents monodevelop communicating android devices. downgrade mono 2.10.1. android monodevelop monodroid

Silverlight tooltip - change ShowDuration lightweight -

Silverlight tooltip - change ShowDuration lightweight - hi trying alter showduration of tooltip , not supported in silverlight. dont want heavyweight tooltip solution available on codeplex. current thought edit in tooltip template. i looked reflector , wasn't able find default duration in tooltip think beingness set in xaml. ( in storyboard open tooltip event) default tooltip style given here http://msdn.microsoft.com/en-us/library/dd334410(vs.95).aspx. there 2 storyboard keys nowadays in can find implementation , override? if posted template illustration infinite duration tooltip grateful. this isn't duplicate of showduration attribute cannot resolve in tooltip @ silverlight 4 cause looking 2 storyboards edit them myself, not mention other question isn't answered there nil can unless create own tooltipservice (note service class not tooltip problem). 5 sec limit baked code, has nil storyboards. if want see in reflector open tooltipservice...

How to add video file at the startup of App in Android Programming? -

How to add video file at the startup of App in Android Programming? - i need add together video file whenever start app showing details. need help that. need know how write code that. save video file in raw folder give video file name in path="android.resource://yourpackagename/"+r.raw.yourvideofilename; see below class public class homevideo extends activity{ private videoview videoview; string extstoragedirectory; protected static final int play = 0x101; protected static final int stop = 0x102; protected static final int pause = 0x103; int state; private string current; private string path ; private videoview mvideoview; @override public void oncreate(bundle icicle) { super.oncreate(icicle); setcontentview(r.layout.homevideo); path="android.resource://yourpackagename/"+r.raw.yourvideofilename; mvideoview = (videoview) findviewbyid(r.id.video); if (path == null || path.length() == 0) { toast...

ios4 - How to get iPhone method called periodically when app in background, using NSTimer when in foreground -

ios4 - How to get iPhone method called periodically when app in background, using NSTimer when in foreground - i using [nstimer scheduledtimerwithtimeinterval ...] works fine when application in foreground, when have in background doesn't appear working. what supposed happen application calls web service on periodic basis, in emulator can watch print out communication. i observing uiapplicationdidenterbackgroundnotification event can alter modes, seems need switch perhaps setting several scheduled notification calls, run problem when switch application calling service twice while, or need cancel notification calls. in emulator not seeing going applicationdidenterbackground when bring programme foreground of concern, bigger question how should calling of method periodically whether in foreground or background. in case makes difference using xcode 3 , 4.0 sdk. i found after restarting computer application did go applicationdidenterbackground . but, in order...

android - How to retrieve the 'last sync' time for an account? -

android - How to retrieve the 'last sync' time for an account? - is possible retrieve time business relationship lastly synchronized, scheme settings->accounts&sync app does? i'm using android 2.2. looking @ 2.2 source accountsyncsettings.java , see status retrieved using: syncstatusinfo status = contentresolver.getsyncstatus(account, authority); but syncstatusinfo , getsyncstatus don't seem part of public api (marked @hide). there other way @ info? the settings app uses contentresolver.getsyncstatus(account, authority) . however, not part of public api. can utilize it, break future release. android sync android-syncadapter

Could not load automation class "Excel.Application" - VBScript Move Mouse -

Could not load automation class "Excel.Application" - VBScript Move Mouse - i'm using code previous question : move mouse - vbscript , excel macro my aim move mouse using vbscript , works through using excel. problem is, runs fine on home machine, has office 2007 on. however, when running script @ work, next error: "could not locate automation class named "excel.application"" the difference can see these work computers have have office 2003 installed instead, excel.aplacation needs changed else maybe? google yielded no useful results. i'm creating in notepad. can help? if can working it's pretty amazing. this because excel cannot referenced correctly on citrix environment. a local re-create of excel needed reference client hard drive (as it's referencing server's installation on citrix). excel vbscript citrix

about working with Fragment in Android 2.1 updated -

about working with Fragment in Android 2.1 updated - my first question i'd inquire is fragment supported android 3.0 ? if developing android 2.1 application, can utilize fragment? my sec question is, implementing this simple feature, fragment choice, developing android 2.1 application, if reply of first question negative, workaround implement feature need? yes can utilize fragment android 1.6 , later. see post on android blog: fragments android android-layout android-emulator android-widget android-manifest

python - How to make a copy of a list of objects not change when modifying the original list? -

python - How to make a copy of a list of objects not change when modifying the original list? - possible duplicates: how clone list in python? what best way re-create list in python? original_list = [object1(), object2(), object3()] copy_list = original_list original_list.pop() if remove object original list, how can maintain re-create list changing well? original list [<object.object instance @ 0x00ea29e0>, <object.object instance @ 0x00ea2dc8>, <object.object instance @ 0x00ea2ee0>] copy list after popping original list (i want equal above) [<object.object instance @ 0x00ea29e0>, <object.object instance @ 0x00ea2dc8>] use copy.deepcopy() deep copy: import re-create copy_list = copy.deepcopy(original_list) for shallow re-create utilize copy.copy(): import re-create copy_list = copy.copy(original_list) or piece no endpoints specified : copy_list = original_list[:] see copy docs explanation ...

c# - How to rollback a transaction in Entity Framework -

c# - How to rollback a transaction in Entity Framework - string[] userstoadd = new string[] { "asd", "asdert", "gasdff6" }; using (entities context = new entities()) { foreach (string user in userstoadd) { context.addtousers(new user { name = user }); } seek { context.savechanges(); //exception thrown: user 'gasdff6' exist. } grab (exception e) { //roll changes including 2 previous users. } or maybe done automatically, meaning if error occurs, committing changes canceled changes. it? ok i created sample application illustration the question , afterwords checked in db , no users added. conclusion: objectcontext.savechange it's automatically transaction. note: believe transactions needed if executing sprocs etc. c# entity-framework transactions rollback savechanges

mysql - SubQuery on Single Table -

mysql - SubQuery on Single Table - ok have table tasks -- taskid (unique autoinc primary) childof (contains task id of parent, or 0 if top tier (no parent)) i need write query selects records childof = 0 ... simple right ? ok need have column returned results tells how many children each task has ... so result ... taskid ... childof ... countchildren 37 ...... 0 .... 3 42 ...... 0 .... 0 99 ...... 0 .... 1 etc.... i know 2 queries need this, need combine them somehow... select taskid parenttaskid, childof tasks childof = 0 and select count(taskid) tasks childof = parenttaskid note: there 2 tiers.. parent , kid ... no grandchildren! makes bit less complicated. any help appreciated. help far! something should it: select taskid parenttaskid, childof , (select count(t2.taskid) tasks t2 t2.childof = t.taskid) countchildren tasks t t.childof = 0 mysql sql subquery hierarchical-data

networking - UDP Client - Open Ports? -

networking - UDP Client - Open Ports? - so right i'm using tcp clients - connect server, open socket , freely getting packets. if decide utilize udp in game? gonna have open ports? example, if using regular wifi, can send udp client without having opening ports problem? thanks. tcp , udp 2 examples of transport layer implementations. both of them using term 'port' determine app should receive incoming packet, routed/filtered differently routers/switches/firewalls/etc. so reply no. have similar problems opening ports. except 'tcp port xxx should opened' have demand 'udp port xxx should opened'. in home networks firewall rules allow outgoing packets (requests) remote port (on server example, port should opened). , when such packet goes through router - creates temporary rule allow answers come local port request packet. so, normal scenario that: packet originated home computer ip 5.5.5.5 . lets has source udp port 55555 , source ip add...

How to show long running process in Android Activity? -

How to show long running process in Android Activity? - i utilize use hourglass cursor in other system, there no cursor image. can't show toast, since can disappear before process finishes. should pop message box? or there more android specific? there progressdialog. works particularly asynctask. android

json - Returning ViewBag as JSONResult result in null data?? wtf? -

json - Returning ViewBag as JSONResult result in null data?? wtf? - what missing? trying following: public jsonresult loggedon() { viewbag.firstname = "todd"; viewbag.lastname = "billings" viewbag.email = "me@rad.com"; homecoming json(viewbag, jsonrequestbehavior.allowget); } the result in js making phone call null/empty? there no built in conversion of viewbag json result? missing? if other object converts json. viewbag expandoobject such there's nil json converter reflect against. best bet here create anonymous object rather rely on viewbag here's illustration found on stackoverflow: can serialize expandoobject in .net 4? json asp.net-mvc-3

caching - imageWithCGImage not being released or is trapped by Cache similar to imageNamed, any work around for generating dynamic images? -

caching - imageWithCGImage not being released or is trapped by Cache similar to imageNamed, any work around for generating dynamic images? - i'm generating uiimages bit-bucket, creating them on fly , swapping uiimageview's image. there way edit uiimageview's image directly? (ie. alter color of specific pixel, without removing uiimage uiimageview, , redraw.) currently, i'm flushing uiimage , using imagewithcgiimage create new one, , assigning uiimageview. works. shows no memleaks. on iphone (3gs) after 100 image replacements, crashes. cache'n issue? memory addition seems hitting phone's limit if cache not releasing, however, simulator not show memory consumption each image swap. stays flatlined without leaks. note: topologyimage array rgba pixel-bucket. ref variables not released. every effort so, crashes next call. without, instruments reports no leaks. ========= cgcolorspaceref colorspaceref=cgcolorspacecreatedevicergb(); cgbitmap...

c# - ASP:Menu.SelectedValue not working -

c# - ASP:Menu.SelectedValue not working - i've been trying utilize asp:menu.selectedvalue property not working if has used before please read on. here code. <asp:menu id="menu1" runat="server" backcolor="#b5c7de" dynamichorizontaloffset="2" font-names="verdana" font-size="0.8em" forecolor="#284e98" onmenuitemclick="menu1_menuitemclick1" staticsubmenuindent="10px" visible="false"> <dynamichoverstyle backcolor="#284e98" forecolor="white" /> <dynamicmenuitemstyle horizontalpadding="5px" verticalpadding="2px" /> <dynamicmenustyle backcolor="#b5c7de" /> <dynamicselectedstyle backcolor="#507cd1" /> <items> <asp:menuitem selectable="false" text="analysis...

c# - Regex to check whether "and,or,not,and not" in a word? -

c# - Regex to check whether "and,or,not,and not" in a word? - i have seneario have check word contains "and,or,not,and not" regex have created fails. can body provide me right regex this? the regex have created this regex objalphapattern = new regex(@"^[not|and not|and|not]"); if(objalphapattern.ismatch(searchterm)) { //// code } but returns true. i have tried word "pen , pencil" , "pen pencil" both returning true.. can help in providing right regex? you're starting begin anchor. if don't want check if happens @ origin of string shouldn't have ^. also, using [] when should using (). in case don't need (). [] indicates character class. don't need that. regex objalphapattern = new regex("\b(and|not)\b"); if(objalphapattern.ismatch(searchterm)) { //// code } that should job. i highly recommend the regex coach help build regex. i highly recommend http://www.regula...

python - find and update duplicates in a list of lists -

python - find and update duplicates in a list of lists - i looking pythonic way solve next problem. have (what think is) working solution has complicated flow controls , isn't "pretty". (basically, c++ solution) i have list of lists. each list contains multiple items of varying types (maybe 10 items per list) overall order of lists not relevant, order of items in individual list important. (ie can't alter it). i looking "tag" duplicates adding field end of individual list. however, in case "duplicate" list 1 has equal values in several preselected fields, not fields (there no "true" duplicates). for example: if original info 5 item list of lists , duplicate defined having equal values in first , 3rd fields: ['apple', 'window', 'pear', 2, 1.55, 'banana'] ['apple', 'orange', 'kiwi', 3, 1.80, 'banana'] ['apple', 'envelope', 'star_fruit...

c# - Bind Checkbox To Bit Field in Database (AJAX) -

c# - Bind Checkbox To Bit Field in Database (AJAX) - i have checkbox want load check in if entry in gridview has been "processed" (processed means has been checked user). i'm thinking best way have field each row called processed , include checkbox in row. when user checks it, want store 1 in database. also, when loads, want checkbox load check or not depending on field in database. i'm having hard time figuring out how bind these 2 things together...i've looked @ syntax can't exclusively tell going on. have tried it, , doens't seem storing info - because of this, think oncheckedchanged event isn't working or @ all. suggestions? cs public partial class vieworders : system.web.ui.page { private string orderbystring; private string fieldstring; private string address; private datagrid datagrid = new datagrid(); protected void page_load(object sender, eventargs e) { orderbystring = orderbylist.selecteditem....

How to get the _current_ duration of a video with FFMPEG? (Not meta) -

How to get the _current_ duration of a video with FFMPEG? (Not meta) - i tried ffmpeg -i myfile, while myfile partially downloaded. ffmpeg gives me whole file duration, not of downloaded part. can see ffmpeg or tool? answer: with mediainfo. with mediainfo sourceforge.net/projects/mediainfo note shameless copy/paste question ffmpeg video-encoding libavcodec

php - database migration is not working in yii -

php - database migration is not working in yii - in yii framework used migration ./yiic migrate create tbl_demo made migration file entered values like <?php class m110714_094912_tbl_demo extends cdbmigration { public function up() { $this-> createtable('{{tbl_demo}}', array( 'id' => 'pk', 'name' => 'varchar \'80\' not null', )) } public function down() { echo "m110714_094912_tbl_demo not back upwards migration down.\n"; homecoming false; } /* // utilize safeup/safedown migration transaction public function safeup() { } public function safedown() { } */ } after entering showing message new migration created successfully. but whenever checking mysql database there no table tbl_demo found. set values of in safeup not made result.every thing working fine don't know why new table not creating? please help me you should go comm...

iphone - Problem in getting time -

iphone - Problem in getting time - hi need increment 15 minutes in time intrval in webservice . code follows nsstring *datestring =obj.string_date_start; // start time 2011-07-01 datestring = [datestring stringbyappendingstring:[nsstring stringwithformat:@" %@ +0000",obj.string_time_start]]; //after statement date 2011-07-01 03:00:00 +0000 nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; [dateformatter setdateformat:@"yyyy-mm-dd hh:mm:ss z"]; nsdate *datefromstring = [[nsdate alloc] init]; datefromstring = [dateformatter datefromstring:datestring]; nsdate *scheduledforyellow = [datefromstring datebyaddingtimeinterval:900]; [dateformatter release]; nsdateformatter *dateformatter1 = [[nsdateformatter alloc] init]; [dateformatter1 setdateformat:@"yyyy-mm-dd hh:mm:ss z"]; nsstring *strtime = [dateformatter1 stringfromdate:scheduledforyellow]; [dateformatter1 release]; nsarr...

php - Full Calendar Event Data -

php - Full Calendar Event Data - i'm thinking of using fullcalendar event calendar on website. my question: there documentation or examples of using php/mysql store access event data? thanks! i'm doing too, , had wished there more finish illustration of php/mysql side, since i'm asp.net/ms-sql guy, had spend more time have liked on basic stuff. here's outline of did. it's pretty basic. first, created table in mysql looks this: create table `events` ( `id` int(11) not null auto_increment, `title` varchar(200) not null, `start_date` datetime not null, `end_date` datetime not null, `event_url` varchar(200) default null, `all_day` tinyint(1) not null default '0', primary key (`id`) ) engine=myisam default charset=utf8; then, wrote php programme named json-events.php, used event source calendar. in program, first need start , end dates currently-displayed calendar: $start_date = $_get['start']; $end_date = $_g...

c++ - safe way to get a singleton instance from multithreads -

c++ - safe way to get a singleton instance from multithreads - method 1 datacenter* datacenter::getinstance() { static datacenter instance; homecoming &instance; } method 2 datacenter* datacenter::getinstance() { if (!m_instanceflag) { m_instance = new datacenter(); m_instanceflag = true; } homecoming m_instance; } i working on multi threaded programming , datacenter accessed more 1 thread. used have method 2 instance of datacenter , worked fine. noted need guard singleton instance beingness called multi threads. my question first need guard singleton instance? or os me? sec questions that, first method right way singleton instance? thanks in advance... 1.you need guard , if don't, of course, os wouldn't you. utilize next code thread-safety: datacenter* datacenter::getinstance() { mutexlocker locker(datacenter::m_mutex); if(!m_instanceflag) { m_instance = new datac...

mysql over ssh over non-standard port -

mysql over ssh over non-standard port - i on computer a, , have mysql running on it, , can connect a~ $ mysql -u punkish -p database , on. i have access computer b has mysql running on it. can ssh b on port 2200 ssh key pairs set up, , 1 time in, can connect db so a~ $ ssh -p 2200 punkish@b b~ $ mysql -u punkish -p database however, want set port forwarding on ssh on computer requests made mysql on port 3307 on computer sent port 3306 on b. allow me utilize gui programme wants connect mysql, can't on tunnel. so, next a~ $ ssh -p 2200 -l 3307:b:3306 punkish@b b~ $ the above logs me right b. not sure if tunnel established, assuming is. however, next fails (in terminal a~ $ mysql -p 3307 -u punkish -p come in password: error 1045 (28000): access denied user 'punkish'@'localhost' (using password: yes) here interesting thing -- have gui programme called sequel pro (a desktop mysql client mac os x), , able create connection mysql@b on ssh...

c++ - How to render lower resolution scene stretched to fullscreen native resolution? -

c++ - How to render lower resolution scene stretched to fullscreen native resolution? - i have seen kind of functionality in directx apps only: when resize window, rendering stretch accordingly, , looks texture stretched. how can efficiently in opengl ? purpose create fullscreen application native resolution, because rather hard take lower resolution on lcd screens, , allow me render lower resolution higher fps. you need render texture or renderbuffer, glblitframebuffer actual default framebuffer. swap buffers normal. c++ opengl

routes - pylons url_for doesn't yield proper internal static. SCRIPT_NAME is not inserted into the resolved URL -

routes - pylons url_for doesn't yield proper internal static. SCRIPT_NAME is not inserted into the resolved URL - i integrate pylons applications apache webserver using mod_wsgi. configuration wsgi such: wsgiscriptalias /mtrace /var/lib/lgmtrace/lgmtrace.wsgi however, using h.url_for within mako template doesn't yield proper url static internal route described in http://pylonsbook.com/en/1.1/urls-routing-and-dispatch.html#internal-static-routes. i've checked environment variable in basecontroller of pylons , script_name has been set /mtrace. so, decided code of url_for function within routes package. turns out, environ attribute never set config variables returned request_config. result, code calls config.environ.get('script_name') never executed. i wonder if can help me on matter because i'm stucked on problem quite time already. has faces same situation? how prepare url can resolved correctly. couldn't find results problem on google , stack...

New to VB.NET - "Expected end of statement" error -

New to VB.NET - "Expected end of statement" error - i'm trying create array of integers: dim amenities() integer amenities=new integer(){1,2,3,4,5} and i'm getting error: expected end of statement dim amenities() integer -----------------------^ it says error happening on "as", have no thought i'm doing wrong. sense stupid asking, i'm stuck. amenities variable name. declaration should read: dim amenities integer() vb.net

sql - Get Latest Rates For Each Distinct Rate Name -

sql - Get Latest Rates For Each Distinct Rate Name - ratename rate effectivedate -------- ---- ------------- rateone 400 2011-01-05 rateone 410 2011-06-31 ratetwo 147 2010-09-21 ratethree 68 2011-07-14 ratetwo 100 2011-10-30 if have info such above, how can run query such i'll have these results: ratename rate effectivedate -------- ---- ------------- rateone 410 2011-06-31 ratethree 68 2011-07-14 ratetwo 100 2011-10-30 basically, need latest rates each distinct rate name. you can seek this: select a.* yourtable inner bring together ( select ratename, max(effectivedate) maxdate yourtable grouping ratename) b on a.ratename = b.ratename , a.effectivedate = b.maxdate sql db2

html - label not working with checkbox -

html - label not working with checkbox - ok, missing? have: <form> <input type="checkbox" name="showratings" value="1" checked> <label for="showratings">show ratings</label> </form> and when click on "show ratings" text, checkbox not toggling. know it's simple. i believe label element links id attribute, not name attribute. seek this: <form> <input type="checkbox" name="showratings" id="showratings" value="1" checked> <label for="showratings">show ratings</label> </form> reference here. html

delphi - Strings in a separate .pas file -

delphi - Strings in a separate .pas file - this may not right place question, if not sense free move it. tagged delphi/pascal because it's working in atm, apply programming guess. anyway doing code cleanup , thinking of moving strings in programme separate single .pas file. there pros , cons doing this? worth doing? to clarify: mean creating separate file, strings.pas in create text string variables. ex current code messages.add('the voucher not sent ' + sname+ ' because application in test mode.'); messages.add('voucher saved ' + sfullpath); messages.add('----------------------------------------------------------'); new code like: messages.add(smsgtext1 + '' + sname + '' + smsgtext2 + '' + sfullpath) the strings.pas file hold string data. hope makes improve sense moving strings separate file idea! keeps them , allow alter them if required. question doesn...

tcp - Nagle-Like Problem -

tcp - Nagle-Like Problem - so have real-time game, c++ sever disabled nagle using sfml library , , client using asyncsocket, disables nagle. i'm sending 30 packets every 1 second. there no problem sending client server, when sending server clients, of packets migrating. example, if i'm sending "a" , "b" in completly different packets, client reads "ab". it's happens 1 time time, makes real problem in game. so should do? how can solve that? maybe it's in server? maybe os settings? to clear: not using nagle still have problem. disabled in both client , server. you have disable nagle in both peers. might want find different protocol that's record-based such sctp . edit2 since asking protocol here's how it: define header message. let's pick 32 bits header. header: msg length: 16b version: 8b type: 8b then real message comes in, having msg length bytes. so have format, how handle things ? ...

How to use bit operations in GLSL 1.3 with OpenGL 2.1 -

How to use bit operations in GLSL 1.3 with OpenGL 2.1 - i'm trying write shader uses many bit operations. in fact supported since glsl 1.30, i'm on opengl 2.1. is there way utilize bit operations opengl version? all sm3 compatible (~opengl 2.1) hardware supports limited integer functionality. done emulating integers floats , not include bit operations. for bit operations, need either glsl 1.3 or ext_gpu_shader4. if reason have opengl 2.1 driver outdated, may lucky still have ext_gpu_shader4 (updating drivers might thought though, in case). if reason graphics card not back upwards better, out of luck. if have ext_gpu_shader4 (check extension string), can add: #extension ext_gpu_shader4 : require to glsl 1.2 shaders, , should work. opengl glsl bitwise-operators

C++ alternatives to preprocessor macro code generation? -

C++ alternatives to preprocessor macro code generation? - i have collection of 50 small, similary structured classes derive mutual base. classes represent items read in file pairs of strings, first string used identify type of pair (which derived class should used represent data) , sec info itself. there visitor (as in visitor pattern) class associated derived classes , mill class generating appropriate derived class type identification string. the setup looks this: class nodeitemvisitor; // forwards declaration. class nodeitembase { public: std::string get_val() const { homecoming val; } virtual std::string idstr() const = 0; virtual void accept(nodeitemvisitor& v) = 0; private: std::string val; }; // forwards declarations of derived classes. class nodeitema; class nodeitemb; ... class nodeitemz; class nodeitemvisitor { public: virtual void visit(nodeitema& ni) = 0; ... virtual void visit(node...

html - Is there a way to set vertical scrollbar for a div? -

html - Is there a way to set vertical scrollbar for a div? - i set empty content div td tag in table. shows there 1 line in div. if set height of div, when input more content it's height, still maintain same size was. how add together vertical scrollbar when content need consume more space in div? thanks. automatically show scroll bars when content greater height , width this: <div style="overflow:auto;"></div> or show scroll bars @ times this: <div style="overflow:scroll;"></div> below reference css overflow properties: overflow overflow-x overflow-y html css

Simple Prolog predicates in javascript -

Simple Prolog predicates in javascript - is there battle-tested way of declaring (simple) prolog predicates , assert facts, in javascript client code? the best find http://www.csse.monash.edu.au/~lloyd/tildelogic/prolog.toy/ch/04.techn1.shtml looks it's calling server-side "toy" interpreter. the nice thing prolog has nice backtracking , unification engine built in language itself. javascript (as languages, btw) doesn't have this, there no way prolog-style functionality "for free". what can do, of course, write interpreter subset of prolog (or library somewhere) , pass predicates it, encoded nice js info structure. but then, why want @ all? need backtracking? need complex unification? perhaps writing recursive search function suffice? question doesn't give many details. javascript prolog logic