Posts

Showing posts from January, 2014

autohotkey - auto hot key and verifying responce -

i automating simple text based .exe running in cmd window on win 7 we have scripts written in auto hot key it's kinda blind man typing them in, no error checking whatsoever auto hot key reliable, need smarts based upon returned any way auto hot key monitor "ok" after every sendinput? not seeing capability an example or suggestion great thanks, jeff there few places can start. first, take @ process in docs, can pid of application. can using autohotkey's own run command. second, working on cmd window can tricky. there few ahk libraries out there can use: stdouttovar - grabs console's output text variable can parse using ahk string functions. consoleapp - redirect , capture standard output. cmdret_stream - stream , store cmd output there not simple built-in functions in ahk easily; have resort elaborate implementations of libraries (or build own).

javascript - Mootools list filter with periodical request to the server -

i have html markup (online users list): <div id="users"> <div class="users_row" title="user1">user1</div> <div class="users_row" title="user2">user2</div> <div class="users_row" title="user3">user3</div> <div class="users_row" title="user4">user4</div> </div> my mootools js function below (periodical function every 5 seconds): get_users: function() { new request.json({ initialdelay: 1, delay: 10000, limit: 25000, method: 'post', url: 'handler.php', onsuccess: function(data){ if (data.users.length) { data.users.each(function(u){ /*wrong...*/ n

sql - Select date which is bigger than another date on a second afinity -

i have 2 identical tables in 2 different dbs ( 1 local , 1 remote ). both of them have datetime ( or datetime2 or else, can still change ) column specifies when added. want records remote table local table have not been brought. for max value local table, tried put condition where remotetable.createtime > maxlocalvalue , don't know why seems overwrite records on boundry. better way ? on second or minute level ? since know values have been added local table, add values remote table not in local table. let local_table repersents local table , remote_table repersents remote table , rcd_1 column in both tables repersents date type. insert local_table (col_1,.....(how evermany columns need), rcd_1) select rcd_1 remote_table remote_table.rcd_1 <> local_table.rcd_1; the way explained question suggest newer dates added local remote long hold true should desired results.

regex - Read fields from text file and store them in a structure -

i trying read file looks follows: data sampling rate: 256 hz ************************* channels in edf files: ********************** channel 1: fp1-f7 channel 2: f7-t7 channel 3: t7-p7 channel 4: p7-o1 file name: chb01_02.edf file start time: 12:42:57 file end time: 13:42:57 number of seizures in file: 0 file name: chb01_03.edf file start time: 13:43:04 file end time: 14:43:04 number of seizures in file: 1 seizure start time: 2996 seconds seizure end time: 3036 seconds so far have code: fid1= fopen('chb01-summary.txt') data=struct('id',{},'stime',{},'etime',{},'seizenum',{},'sseize',{},'eseize',{}); if fid1 ==-1 error('file cannot opened ') end tline= fgetl(fid1); while ischar(tline) i=1; disp(tline); end i want use regexp find expressions , did: line1 = '(.*\d{2} (\.edf)' data{1} = regexp(tline, line1); tline=fgetl(fid1); time = '^time: .*\d{2]}: \d{2} :\d{2}' ; data

java - Set MessageId in header before sending mail -

i sending mails application using java mail on smtp server, port 465. need that, have set message-id before sending mail. did r&d , found code below. had override method updatemessageid() of mimemessage import javax.mail.messagingexception; import javax.mail.session; import javax.mail.internet.mimemessage; public class custommimemessage extends mimemessage { public custommimemessage(session session) { super(session); } @override protected void updatemessageid() throws messagingexception { setheader("message-id", "message id"); } } and had made instance of custommimemessage in service , invoke updatemessageid() method using instance, still message-id generated gmail. in code setheader("message-id", "message id"); you trying set "message id" message-id quite wrong have set unique id qualify rules of message id ( read this ). try this..,. import javax.mail.messagingexception; import javax.mai

How to return bytes to C#/.net from C? -

here's c function: dll_public void alve_ripemd320__finish(void* instance, uint32_t* out_hash) { ... (uint32_t i=0, i_end=10; i<i_end; i++) { out_hash[i] = h[i]; } } and here how i'm calling c#: [dllimport(platformconstants.dllname)] static extern void alve_ripemd320__finish (intptr instance_space, ref byte[] hash); ... public byte[] finish() { byte[] result = new byte[40]; alve_ripemd320__finish (c_instance, ref result); return result; } and produces ugly segfault, goes away if comment c-code above writes out_hash.... question is, correct way of passing buffer of bytes using pinvoke? your c api writing unsigned integers. typically expect mapped as: [dllimport(platformconstants.dllname, callingconvention=callingconvention.cdecl)] static extern void alve_ripemd320__finish(intptr instance_space, uint[] hash); public uint[] finish() { uint[] result = new uint[10]; alve_ripemd320__finish (c_in

Objective C: Initialization of Objects -

this question has answer here: difference between [nsmutablearray array] vs [[nsmutablearray alloc] init] 2 answers if wanted create uiimage example, difference in following 2 lines of code: uiimage *img = [uiimage imagewithcgimage:cgimage]; uiimage *img = [[uiimage alloc] initwithcgimage:cgimage]; is case of "same end, different means"? imagewithcgimage: returns autoreleased instance while initwithcgimage: returns image must release yourself. typically can count on class method return autoreleased object while instance init method returns object must release. if using arc code, same thing, see related question more information: with arc, what's better: alloc or autorelease initializers?

c++ - Why is this program crashing after it outputs a few elements -

#include <iostream> #include <ctime> #include <cstdlib> using namespace std; int main() { srand(time(null)); int sizer = (rand() % 15) + 2; int nenad[sizer]; (int = 0; < sizer;i++) nenad[i] = (rand() % 15) + 1; (int = 0; < sizer;i++) cout << nenad[i] << endl; (int = 0; < sizer;i++) { (int j = + 1;i < sizer;j++) { if (nenad[i] > nenad[j]) { int temp = nenad[i]; nenad[i] = nenad[j]; nenad[j] = temp; } } } cout << "the biggest elements : " << nenad[sizer-1] << " , " << nenad[sizer-2] << endl; the program adds random amount of random numbers array. while they're being outputed program crashed. why? your loop end condition seems curious, presume for (int j = + 1;i < sizer;j++) should be for (int j = + 1;j < s

ActiveAdmin Rails 4 NoMenuError -

i using rails 4 branch of activeadmin. i have location model excluded menu via: activeadmin.register location belongs_to :area menu false end the area model not excluded menu. when try create new location in test such by: post :create, location: { "name" => "sorry"}, area_id: a.id i getting following exception: activeadmin::menucollection::nomenuerror: no menu name of :area in availble (sic) menus: default, utility_navigation, season when add locations menu (i.e. comment out 'menu false')..the problem goes away. did not have problem pre-rails 4. obviously rather able keep using method exclude menu rather css. any suggestions? just remove "menu false", doesn't work belongs_to

PHP Exec execute two commands at the same time in linux -

i want execute 2 commands @ same time, using if((bool)@$ip) shell_exec("command1; command2"); it work needs finish 1 command , start other command. can have please? thanks if put & symbol @ end of first command, run command in background (asynchronously) php script continue next line, can fire off next command.

c# - Modify readonly members in a class -

i learning monogame these days , there class called "texture2d" has 2 readonly members width , height. take values actual graphic used. there way can change values width , height of texture changes (either deriving or other way)? , if derive it, how obtain object content.load() method? you don't need change width/height of source texture. use spritebatch.draw method destination rectangle. void draw(spritebatch spritebatch) { spritebatch.begin(); spritebatch.draw(texture, new rectangle(100, 100, 200, 200), color.white); spritebatch.end(); } take @ other overloads scale , rotation.

node.js - coffeescript + nodejs: caching the compiled server-side javascript using require -

i'm running node web server via "coffee my_server.coffee", , load dependencies via require './my_library.coffee' my codebase pretty big, , it's starting take significant amount of time server start up, believe due coffeescript compilation... when convert entire thing javascript, loads faster. what's least painful way of caching compiled javascript, when restart server compiles files i've edited since last started it? ideally totally transparent... keep on requiring coffeescript , gets cached behind scenes. alternatively, run "node my_server.js", , have watcher on directory recompiles coffeescript whenever edit it, don't idea because clutters directory bunch of js files, makes gitignore more complicated, , means have manage watcher function. there way me have cake (running "coffee" executable , requiring coffee files) , eat (fast load times)? well if don't want "clutter directory bunch of .js fil

java - Thread variable after call start and run -

i realized code: public class testthread3 extends thread { private int i; public void run() { i++; } public static void main(string[] args) { testthread3 = new testthread3(); a.run(); system.out.println(a.i); a.start(); system.out.println(a.i); } } results in 1 1 printed ... , don't it. haven´t found information how explain this. thanks. results in 1 1 printed so first a.run(); called main-thread directly calling a.run() method. increments a.i 1. call a.start(); called forks new thread. however, takes time i++; operation has not started before system.out.println(...) call made a.i still 1. if i++ has completed in a thread before println run, there nothing causes a.i field synchronized between a thread , main-thread. if want wait spawned thread finish need a.join(); call before call println . join() method ensures memory updates done in a thread visible threa

google chrome extension - Getting Port: Could not establish connection. Receiving end does not exist. and nothing has worked. Literally -

so, i've looked every other stack overflow post on topic, changed line line, , nothing working. (nevermind 99% of code straight off dev.google.com) no matter try, error mentioned in title. there doesn't seem explanation, i'm hoping group can spot potentially stupid thing i'm missing. thanks! manifest.json { "manifest_version": 2, "name": "topic fetch", "description": "this extension extracts meta keywords news article , give related articles google news", "version": "1.0", "browser_action": { "default_icon": "icon.png", "default_title" : "get related links" }, "background": { "persistent": false, "scripts": ["background.js"] }, "content_scripts": [ { "matches": ["*://*/*"], "js": ["content-script.js"

c# - Consuming WCF Soap Service running on Mono from Android KSoap2 -

i working on android/c# project. need able have wcf soap service can either run on windows or linux (mono). its working fine on windows , can access wcf service on mono wcf test client provided in visual studio , works fine when accessing android using ksoap2 error http request failed, http status: 415 below how soap service started string methodinfo = classdetails + methodinfo.getcurrentmethod().name; try { if (environment.getenvironmentvariable("mono_strict_ms_compliant") != "yes") { environment.setenvironmentvariable("mono_strict_ms_compliant", "yes"); } if (string.isnullorempty(soapserverurl)) { string message = "not starting soap server: url or port number not set in config file"; library.logging(methodinfo, message); library.setalarm(messa

What are the C++ 03 Macros? -

i'm trying compile library using -std=c++03 , compilation failing because nullptr_t not defined. how can guarantee c++03 instead of c++11 compilation using hard-coded macro? thanks in advance. the version detection present in standard value of macro __cplusplus : 201103 c++11 (iso/iec 14882-2011 §16.8/1) , 199711 c++98 (iso/iec 14882-1998 §16.8/1). c++03 didn't apparently deserve own number , uses 199711 (iso/iec 14882-2003 §16.8/1). if seems inadequate means of feature detection, you're not alone . in case, need consult documentation of library in question determine how configure pre-c++11 if such possible.

c++ - How to build simple OpenCV program -

i trying build program @ http://docs.opencv.org/doc/tutorials/introduction/display_image/display_image.html after installing opencv on machine. try compile using g++ display_image.cpp -o displayimage following error: display_image.cpp:(.text+0x9d): undefined reference `cv::imread(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)' i think has how i'm compiling program (some unresolved reference opencv2) don't know how resolve it. i'm using ubuntu 13.04. thanks! edit: realize similar opencv 2.3 compiling issue - undefined refence - ubuntu 11.10 don't understand use of pkg-config opencv --cflags --libs , how avoid you got linker error because didn't specify opencv on gcc command line follow tutorial ( http://opencv.willowgarage.com/wiki/compileopencvusinglinux ) link sample opencv

python - How to Print this statment in to a txt file -

i trying write txt file getting typeerror . how go this? here code below: yesterdays_added = f1_set - f2_set yesterdays_removed = f2_set -f1_set open('me{}{}{}.txt'.format(dt.year, '%02d' % dt.month, '%02d' % dt.day), 'w') out: line in todays: if line in yesterdays_added: out.write( 'removed', line.strip()) elif line in yesterdays_removed: out.write ('added', line.strip()) line in yesterdays: if line in yesterdays_added: out.write ('removed', line.strip()) elif line in yesterdays_removed: out.write ('added', line.strip()) this error getting: out.write ('added', line.strip()) typeerror: function takes 1 argument (2 given) you need concatenate together. out.write("added "+line.strip()) # or out.write("added {}".format(line.strip())) for example, >>> "added "+"a

android - performItemClick not working after setAdapter -

[solved] i have following structure in code: listview accountlistview = (listview) findviewbyid(r.id.accountlisting); arrayadapter<string> adapter = new arrayadapter<string>(this, r.layout.list_view_item, r.id.nametextview, currentaccounts); accountlistview.setadapter(adapter); accountlistview.performitemclick(null, 0, 0); currentaccounts array, , has data on it. when try performitemclick after setting adapter, nullpointerexception. i override onkeypress, run "performitemclick" , works fine. i know why doesn't work when trying perform click after setting adapter. (after debugging saw lastvisibleposition -1) why? [edit] using ((listview)findviewbyid(r.id.accountlisting)).performitemclick(null, 0, 0); works, except, if used right after setting adapter. (look @ comments more info) [edit 2] stack trace: 07-24 13:07:56.710: e/androidruntime(9455): fatal exception: main 07-24 13:07:56.710: e/androidruntime(9455): java.lang.runtimeexceptio

php - How to turn a mysql table with a simple parent child relationship to a nested set? -

i have large mysql table - altered ldap dump. 120k employees. the table needed lots of things have 1 task pegging server - recursive queries. each employee has empl. id , supervisor id on row. easy parent child relationship. 1 of applications have mass email app. , use ldap table search employees under given manager. may go 6-10 levels deep , include 10-20k rows. intense. current system not working large queries. so how can automate parent child relationship nested set? beyond have done in mysql appreciated. also how has not been asked 100 times? you may want take @ article: http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/

python - Error in RSA algorithm output when dealing with large integers -

i wrote code generate pseudo-random prime numbers, public/private keys, etc. sake of implementing rsa encryption (for personal amusement , nothing more). able encode text, generate public/private key, encrypt, decrypt, , decode when encoded text integer ~10^12 or less. e.g. original message: hello plaintext equivalent: 448378203247 public key: (540594823829, 65537) private key: (540594823829, 261111754433) ciphertext: 63430225682 decrypting ciphertext returns original plaintext. however, when encoded text larger integer, process fails. e.g. original message: man plan canal panama plaintext equivalent: 39955594125525792198857762901926727877852838348601974063966023009 public key: (662173326571, 65537) private key: (662173326571, 29422219265) ciphertext: 429717871098 in case ciphertext much smaller plaintext, makes 1 suspect in encryption process went wrong. , sure enough, decrypt ciphertext , 58514793315 (clearly not original plaintext). i'm thinking issue how python

javascript - Error messages on contact form -

right now, i'm validating contact form using java/ajax, , generating error messages in javascript following messages: { fname: "please fill in name", email: "your email contact you", subject: "please fill in subject of message", recipient: "please let know contact", message: "please fill out message", captcha: "please answer 2x3" } which generates <label class="error">the error message id</label> . i'm not sure how label generated, i'm wanted replace empty text inputs value of error message when it's not filled out. i've tried using fname.value = "the error message"; but doesn't seem work. ideas on how error message show within input instead of generating label? form markup: <form name="myform" id="myform" action="" method="post"> <fieldset> <label for="f

java - Polarion WorkItem class getter methods returning null -

i attempting write java program gets work record information off of polarion , writes dat file later use. i have connected our servers , have retrieved workitem objects, none of getter methods (besides geturi() ) seem work, poses problem since need use workitem class's getworkrecords() method satisfy requirements of project. i have tried of getter methods class on both our main polarion server , our 'staging' server, use kind of testing area things such program trying write , on have full permissions. regardless of permissions, querying dummy workitems created , assigned myself, there shouldn't permissions issues since attempting view own workitems. here code program: package test; //stg= 10.4.1.50 //main= 10.4.1.10 import java.io.fileinputstream; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.io.objectinputstream; import java.io.objectoutputstream; import java.net.malformedurlexception;

architecture - Parallela FPGA- 64 cores performance compared with GPUs and expensive FPGAs? -

this parallela: http://anycpu.org/forum/viewtopic.php?f=13&t=66 it has 64 cores, 1gb ram, runs linux, ethernet- shouting it.... my question is, performance/capability perspective how parallela compare more expensive fpgas? have wider buses/more memory/faster processor clocks/more processors on chip? i understand gpus massively parallel simple operations , cpus better more complicated single-threaded computation- expensive fpgas , parallela fit on curve? the parallela runs linux- yet under impression fpgas have logic flashed on them writing verilog or vhdl? a partial answer : fpgas tend not have processors on chip (there exceptions) - if think processing fetching instructions , executing them 1 after other, haven't grasped fpgas. if can see how execute 1 complete iteration of inner loop in single clock cycle, you're getting there. there tasks easy, , fpga can wipe floor other solution. there tasks impossible, , parallela contender. don't see 1 hi

objective c - Xcode 4 - clang: error: linker command failed with exit code 1 (use -v to see invocation) -

Image
i keep getting following error when trying build project. did google search , found folks had same name variables between classes and/or forgot include/had multiple inclusions of classes in linker, not case me. please see below picture: as says in error can't find main function. in ios project function comes template , looks this: int main(int argc, char *argv[]) { @autoreleasepool { return uiapplicationmain(argc, argv, nil, nsstringfromclass([appdelegate class])); } } it needed because main function entrance point every c, c++ , objective-c program. located in file called main.m in supporting files group (which doesn't mean you're not allowed move elsewhere). to fix error, if file/the function exists. if do, open utilities pane (the right one), go first tab , if checkbox of target selected.

On deleting C++ pointers -

ok..so confuses hell out of me. dealing legacy c++ code parts of have feeling not safe, not 100% sure. here's snippet, example of risky stuff. struct { a() : a_ptr(0) {} a(some_type *ptr) : a_ptr(ptr) {} const some_type *a_ptr; }; struct b { b() : b_ptr(0) {} b(some_type *ptr) : b_ptr(ptr) {} const some_type *b_ptr; }; struct data { data(...) {//-stuff doesn't invole aptr_list or bptr_list; } ~data() { for(std::vector<a*>::iterator itr = aptr_list.begin(); itr != aptr_list.end() ++itr) { delete *itr; } for(std::vector<b*>::iterator itr = bptr_list.begin(); itr != bptr_list.end() ++itr) { delete *itr; } } std::vector<a*> aptr_list; std::vector<b*> bptr_list; private: data(const data&); data& operator=(const data&); }; then in implementation, find: void some_func(...) { //-inside function data& d = get_data(...

Oracle SQL Conditional Select Query -

this question has answer here: oracle sql select matching query 1 answer i have table below uid rid time_type date_time a11 1 2 5/4/2013 00:32:00 (row1) a43 1 1 5/4/2013 00:32:01 (row2) a68 1 1 5/4/2013 00:32:02 (row3) a98 1 2 5/4/2013 00:32:03 (row4) a45 1 2 5/4/2013 00:32:04 (row5) a94 1 1 5/4/2013 00:32:05 (row6) a35 1 2 5/4/2013 00:32:07 (row7) a33 1 2 5/4/2013 00:32:08 (row8) can use normal select query extract data such becomes uid rid time_type date_time a43 1 1 5/4/2013 00:32:01 (row2) a98 1 2 5/4/2013 00:32:03 (row4) a94 1 1 5/4/2013 00:32:05 (row6) a35 1 2 5/4/2013 00:32:07 (row7) the date_time field in asc order. logic

if statement - How to automatically track when a bit.ly link has been clicked x times -

i'm looking running promotion users tweet custom bit.ly (or other url link service) link , have link clicked others x times (say, 3 times) automatically have piece of content (think pdf) unlocked them. i'm @ bit of loss how accomplish this. thinking of using ifttt.com, don't track how many times bit.ly link has been clicked. so steps following: generate new unique link given webpage track when link has been clicked 3 times automatically send user email when link has been clicked 3 times link unlocked content anyone have ideas here? can think of scraping bit.ly's stat page periodically , seeing how link has been clicked, seems potentially quite slow , resource intensive. you host own url shortener take care of counting clicks, redirecting bit.ly/whatever, emailing, etc. for instance: http://yourls.org/ edit: well, bit.ly seems have pretty nice api. check http://dev.bitly.com/link_metrics.html#v3_link_clicks

java - Apache Solr - How to prevent splitting when searching phrases -

i have following fieldtype: <fieldtype name="textfield" class="solr.textfield" positionincrementgap="100"> <analyzer type="index"> <charfilter class="solr.htmlstripcharfilterfactory"/> <tokenizer class="solr.whitespacetokenizerfactory"/> <filter class="solr.trimfilterfactory"/> <filter class="solr.lengthfilterfactory" min="3" max="30"/> <!-- in example, use synonyms @ query time <filter class="solr.synonymfilterfactory" synonyms="index_synonyms.txt" ignorecase="true" expand="false"/> --> <filter class="solr.stopfilterfactory" ignorecase="true" words="stopwords.txt" enablepositionincrements="true"/> <filter class="solr.lowercasefilterfactory"/> <filter class="solr.worddelimiterfilterfa

rally - Print capability in App SDK 2 -

i add print capability app sdk 2 custom app displays grid , print option under gear icon, print page empty. have example of app prints grid? a grid app example found here modified include printing capability: <!doctype html> <html> <head> <title>gridexample</title> <script type="text/javascript" src="/apps/2.0rc1/sdk.js"></script> <script type="text/javascript"> rally.onready(function () { ext.define('customapp', { extend: 'rally.app.app', componentcls: 'app', launch: function() { rally.data.modelfactory.getmodel({ type: 'userstory', success: function(model) { this.grid = this.add({ xtype: 'rallygrid', itemid: '

entity framework 4 - sub query within linq select statement -

i want list of student details , attended hours using linq query in entity framework. i using following query bind list of students details , total hours attended them . var students = (from pa in db.tblstudents select new studentmodel { name = pa.name, studentid = pa.id, rollno = pa.rollno, department = pa.department, phone = pa.phone, address = pa.address, totalhours = (from time in tblhours time.studentid = pa.id select time.hours).sum() }).distinct().asqueryable().tolist(); studentmodel looks below:- public class studentmodel { public string name { get; set; } public int studentid { get; set; } public string rollno{ get; set; } public string department{ get; set; } public long phone{ get; set; } public string ad

javascript - Server side redirect not working after jQuery upload script -

i have following code simple web page want let user upload, track upload progress , redirect them after upload complete (this need on thr server side) works fine without bottom script show upload progress. there in ajax call preventing redirect? backend in python on google app engine , glad show code don't think relevant. <style> .progress { position:relative; width:400px; border: 1px solid #ddd; padding: 1px; border-radius: 3px; } .bar { background-color: #b4f5b4; width:0%; height:20px; border-radius: 3px; } .percent { position:absolute; display:inline-block; top:3px; left:48%; } </style> <div class="row"> <div class="span12"> <div class="center-it"><h1>upload video:</h1><br> </div> <form action="{{upload_url}}" method="post" enctype="multipart/form-data"> <input type="file" name="file" cl

python - In PyDev, how do I refactor a local variable into an attribute? -

i need break method uses several local variables , make variable available new methods attributes. thought able use refactoring rename each local variable adding self. front. unfortunately, pydev disagrees me! there way pydev want?

css3 - iOS Safari runs out of memory with "-webkit-transform" -

http://jsfiddle.net/es4xg/8/ crashes retina devices. ios safari "easily" runs out of memory , crashes when using -webkit-transform instructions. approach delivers impressive graphics but, on retina displays, seems consume lot of memory , cause crashes. the demo above shows text displayed 150 times otherwise run on pc browser: the font size , number of elements exaggerated cause crash. -webkit-transform: translate3d(0,0,0) intended force gpu accelerated drawing of each element. in real application, using translatex , y , z , scale , others seem connected gpu use in same way. images , sprites used, not connected crashes directly. given scenario above: 1) bug ios safari crashing? 2) plugging in apple instruments memory monitor, virtual memory climbs , seems culprit of crash. using memory? 3) there other gpu accelerated approach not consume lot of memory? it crashes because height of hardware accelerated items 257,025px in example. in tests appear

jQuery simple .fadeIn demo not working for me -

why not work? have been sitting here hours confused... works in jsfiddle http://jsfiddle.net/5shdr/8/ <!doctype html> <html> <head> <style> body { padding:0; margin:0; } #menu { width:100%; background-color:#ddd; } #menu .link { display:inline-block; margin-left:5px; margin-right:5px; padding:5px; cursor:pointer; } #menu .link.active { color:blue; } #main { padding:5px; } #main .content { display:none; } </style> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script> <script> $('.link').click(function () { if ($(this).hasclass('active')) return false; var name = $(this).attr('id'); var $visible = $('#main .content:visible'); $('.active').removeclass('active'); $(this).addclass('active'); if ($visible.length == 0) showcontent(name); else $visible.fadeout(5

ob get contents - Sometimes my PHP function doesn't work well -

i wrote php function copy internet image local folder, works well, generate invalid file size of 1257b. function copyimagetolocal($url, $id) { $ext=strrchr($url, "."); $filename = 'images/' . $id . $ext; ob_start(); readfile($url); $img = ob_get_contents(); ob_end_clean(); $fp=@fopen($filename, "a"); fwrite($fp, $img); fclose($fp); } note: $url passed in valid, function fails @ first time, may successful second or third time. it's strange... require special php settings? please me! i have found real reason: test image url not allowed program accessing, though can opened in browser. tried other image url, function works well. so, seems need find way process kind of cases. guys! why don't open file , write disk so: file_put_contents($filename, fopen($url, 'r')); this buffering shouldn't run memory problems (since storing whole image in memory before writing file)

android JSON in ListFragment -

i'm new android development. i've no problem json when used in mainactivity got problem when move code listfragment this line nothing happen: jsonobject json = userfunctions.announcementfeed(myid, mytype); here full code: package com.example.demo123; import java.util.arraylist; import java.util.hashmap; import library.userfunctions; import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobject; import android.os.bundle; import android.support.v4.app.listfragment; import android.util.log; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.simpleadapter; public class announcementlist extends listfragment { private static final string tag = "myannouncement"; jsonarray announcementlist = null; userfunctions userfunctions; string myid = mainactivity.myid; string mytype = mainactivity.mytype; @override public view oncreateview(layoutinflater inflater, viewgroup

Adding Search Functionality To My Apps Android -

i want add search functionality apps, , did research ( http://developer.android.com/training/search/index.html ) don't want use database/sql. want ( http://www.androidhive.info/2012/09/android-adding-search-functionality-to-listview/ ) put search terms in list of strings. question: how implement function click 1 of search terms in listview, , strings of search term clicked show up. or there alternative way can this? comments appreciated probably might you.. see here think should implement new adapter rather using arrayadapter. don't know whether possible using arrayadapter also.

java - How to display parameter in a single item's detail and not in a single listview item -

i'm trying solve i'm not sure about. wants show parameter call "decription" in single item's detail when single listview item selected "decription" should not displayed on single listview item. know problem lies i'm not sure how solve it. please kindly give me suggestions! here code mistake lies: // adding menuitems listview listadapter adapter = new simpleadapter(this, menuitems, r.layout.list_item, new string[] { key_title, key_desc, key_country_name, key_venue_name, key_start_time }, new int[] { r.id.title,r.id.description, r.id.countryname, r.id.venuename, r.id.starttime }); setlistadapter(adapter); // selecting single listview item listview lv = getlistview(); lv.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(adap

google app engine - EndPointsModel query by ancestor -

how can query ancestor according user_id token ? this code: class myuserclass(endpointmodel): user_object = ndb.userproperty(required=true, indexed=false) class mymodel(endpointmodel): ... @mymodel.method(user_required=true, name="model.add", path="model") def add_mymodel(self, my_model): gplus_user_id = auth_util.get_google_plus_user_id() if gplus_user_id none: raise endpoints.forbiddenexception(nidappuser.no_gplus_id) user = myuserclass.get_or_insert(gplus_user_id, user_object=endpoints.get_current_user()) my_model.parent = user.key.string_id() my_model.put() return my_model @mymodel.query_method(user_required=true, name="list.mymodel", path="models", query_fields=('order','attr1',)) def list_models(self, query): gplus_user_id = auth_util.get_google_plus_user_id() if gplus_user_id none: raise endpoints.forbi

PHP: How can I get this value? -

$result2 = $db->prepare('select `lkey_member` mxscript_slayer_licensekeys `lkey_key` = ?'); $result2->bindparam(1, $auth); $result2->execute(); how can print value of lkey_member result2? first fetch it, echo it. in case can use fetchcolumn function pdo has specifying index of column want fetch (in case 1 retrieving): $lkeymember = $result2->fetchcolumn(0); echo $lkeymember;

speech recognition - How to recognize arabic cultutre in c# -

i developing software recognize arabic language application not able recognize arabic. using following code recognize cultures installed in system, it’s giving 'en-us' , 'en-gb', although have installed arabic language in windows 7 thread.currentthread.currentculture = new cultureinfo("ar-sa"); foreach (recognizerinfo config in speechrecognitionengine.installedrecognizers()) { if (config.culture.tostring() == preferredculture) { speechrecognitionengine = new speechrecognitionengine(config); break; } } my question how add arabic culture in application without changing windows language english arabic; want retain windows language english commonly understood. microsoft doesn't ship arabic sr engine any windows release. far know, there no sapi-compatible arabic sr engine available. sorry.

css - Javascript to auto size NAV menu columns -

i trying style nav menu created , fed in dynamically saas cms. want menu auto resize given number of columns. example: if nav overall width 960px. want menu items resize in 5 equal columns. secondly menu goes 2 children deep. if top level parant. seen default on page. when hover children appear similar site. http://www.laylagrayce.com/ (ignoring images in menu.) want resize equal columns. how can this? you have heard responsive websdesign? in case think onlyest solusion.

oracle sqldeveloper - Disable autocommit in SQL Developer when using MySQL -

i'd connect mysql server oracle sql developer, autocommit disabled. default, mysql connections have autocommit enabled, rather odd. the global setting in sql developer unchecked, , set autocommit=0; results in error set autocommit script command forced off, connection level autocommit on. in connection's settings no other options besides hostname, port , drop down box database selection. i'm using sql developer 3.2.10 latest jdbc connector, 5.1. you run error if try , use start transaction; -- sql statements commit; ...out of box on mysql database in sqldeveloper (as michael mentioned in comment answer.) in order around error michael referenced in comment can use following hint: /*sqldev:stmt*/start transaction; -- sql statements /*sqldev:stmt*/commit; found information here .

android - AsyncTask.execute() returns null -

i using below code version json webservice.java public void getsingleresponse(final string url) { class task extends asynctask<string, string, string> { @override protected string doinbackground(string... params) { // todo auto-generated method stub string resp; resp = ""; httpclient httpclient = new defaulthttpclient(); try { log.d("url", "" + params[0]); httpresponse response = httpclient.execute(new httpget( params[0])); httpentity entity = response.getentity(); log.d("entity ", "" + entity); string responsestring = entityutils.tostring(entity, "utf-8"); resp = responsestring; globalvar.version = resp;

Writing to the wrong class instance in java -

note: code work in progress solution assignment in discrete optimization pascal van hentenryck on coursera. of not want see possible solutions or hints might not want read further. i new java might totally wrong code. have spent while on code no progress. stepping through code in eclipse. when step through code below trying update instance of branch[0] when update branch[0].path thisnode.path gets updated , when update branch[1].path branch[0].path , thisnode.path gets updated (at-least watch window shows). what doing wrong here ? void iterateonestep(bnbnode thisnode, int next_path){ bnbnode [] branch; branch = new bnbnode [2]; //item not picked branch[0] = new bnbnode(items.size()); branch[0].availablecapacity = thisnode.availablecapacity; branch[0].path = thisnode.path; branch[0].path[next_path] = 0; branch[0].val = thisnode.val; //item picked branch[1] = new bnbnode(items.size()); branch[1].availablecapacity = t

javascript - CSS3 transform rotate using mouse position -

i want rotate div element using css3 "transform:rotate". want degree mouse position, tracking mouse. how can achieve this? thanks! check http://jsfiddle.net/arunberti/fsgpf/1/ $(document).ready(function() { // same yours. function rotateonmouse(e, pw) { var offset = pw.offset(); var center_x = (offset.left) + ($(pw).width() / 2); var center_y = (offset.top) + ($(pw).height() / 2); var mouse_x = e.pagex; var mouse_y = e.pagey; var radians = math.atan2(mouse_x - center_x, mouse_y - center_y); var degree = (radians * (180 / math.pi) * -1) + 100; // window.console.log("de="+degree+","+radians); $(pw).css('-moz-transform', 'rotate(' + degree + 'deg)'); $(pw).css('-webkit-transform', 'rotate(' + degree + 'deg)'); $(pw).css('-o-transform', 'rotate(' + degree + 'deg)'); $(pw).css('-m

orm - Many to Many relation in Entity Framework doesn't retrieve the related collections -

i'm trying map many many sql relation in entity framework using code first. here classes: [table("b3_360viewerdata")] public class viewerdata : entity { //.... other properties ...// // navigation property public entitycollection<feature> features { get; set; } } [table("b3_feature")] public class feature : entity { //.... other properties ...// // navigation property public icollection<viewerdata> viewerdata { get; set; } } create table [dbo].[viewerdatafeatures]( [feature_id] [int] null, [viewerdata_id] [int] null ) the insertion in table went expected, when want retrieve viewerdata entity don't features collection populated null. am missing something?

html - absolute div visibility outside of div relative parent -

css: ul#menu-ediloc li { float:left; padding-left:5px; position:relative; } ul#menu-ediloc ul { z-index:500; position:absolute; } i have drop menu this, when goes down sub menu hidden touches next div slideshow , it's outside relative parent. i tryed put position:relative; body although fixes visibility problem messes menu. any ideas? <div id="header"> <ul id="menu-ediloc"> <li> <ul id="sub-menu"> <li> </li> </ul> </li> </ul> </div> <div id="slider"> </div> i tryed put slider in header , put relative on header, same on body messes sub-menu. way sub-menu works if put relative on ul li tag. add following css #header{ position: relative; z-index: 999; }

javascript - jQuery Validate stop form submit -

i using jquery validate form, when form validated reloads or submits page want stop action. use event.preventdefault(), doesn't work. here code: $("#step1form").validate(); $("#step1form").on("submit", function(e){ var isvalid = $("#step1form").valid(); if(isvalid){ e.preventdefault(); // things after validation $(".first_step_form").fadeout(); if(counter == 3){ $(".second_step_summary").fadein(); $(".third_step_form").fadein(); $(".third_inactive").fadeout(); }else if(counter < 3){ $(".second_step_form").fadein(); $(".third_inactive").fadein(); } $(".first_step_summary").fadein(); $(".second_inactive").fadeout(); } return false; }); the submithandler callback function built plugin. submithandler