Daily Archives

Articles indexed Saturday January 15 2011

Page 9/28 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Returns an associative array comprising a function's argument list in php

    - by diEcho
    Hello All, in php func_get_args — Returns an array comprising a function's argument list it returns numeric index array is there any function/way in php by which we get associative array i.e. key=value pair i m explaining with example: test.php <?php function foo() { include './fga.inc'; } $x=20; $y=30; foo($x, $y); ?> fga.inc <?php $args = func_get_args(); echo "<pre>"; print_r($args); echo "</pre>"; ?> which should returns array ( 'x'=> 20, 'y' => 30, )

    Read the article

  • Adding Information in SQLite

    - by Cam
    Hi All, I am having trouble with my Android App when adding information into SQLite. I am relatively new to Java/SQLite and though I have followed a lot of tutorials on SQLite and have been able to get the example code to run I am unable to get tables to be created and data to import when running my own app. I have included my code in two Java files Questions (Main Program) and QuestionData (helper class represents the database). Questions.java: public class Questions extends Activity { private QuestionData questions; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.quiztest); questions = new QuestionData(this); try { Cursor cursor = getQuestions(); showQuestions(cursor); } finally { questions.close(); } } private Cursor getQuestions() { //Select Query String loadQuestions = "SELECT * FROM questionlist"; SQLiteDatabase db = questions.getReadableDatabase(); Cursor cursor = db.rawQuery(loadQuestions, null); startManagingCursor(cursor); return cursor; } private void showQuestions(Cursor cursor) { // Collect String Values from Query and Display them this part of the code is wokring fine when there is data present. QuestionData.java public class QuestionData extends SQLiteOpenHelper { private static final String DATABASE_NAME = "TriviaQuiz.db" ; private static final int DATABASE_VERSION = 2; public QuestionData(Context ctx) { super(ctx, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL("CREATE TABLE questionlist (_id INTEGER PRIMARY KEY AUTOINCREMENT, QID TEXT, QQuestion TEXT, QAnswer TEXT, QOption1 TEXT, QOption2 TEXT, QOption3 TEXT, QCategoryTagLvl1 TEXT, QCategoryTagLvl2 TEXT, QOptionalTag1 TEXT, QOptionalTag2 TEXT, QOptionalTag3 TEXT, QOptionalTag4 TEXT, QOptionalTag5 TEXT, QTimePeriod TEXT, QDifficultyRating TEXT, QGenderBias TEXT, QAgeBias TEXT, QRegion TEXT, QWikiLink TEXT, QValidationLink1 TEXT, QValidationLink2 TEXT, QHint TEXT, QLastValidation TEXT, QNotes TEXT, QMultimediaType TEXT, QMultimediaLink TEXT, QLastAsked TEXT);"); db.execSQL("INSERT INTO questionlist (_id, QID, QQuestion, QAnswer, QOption1, QOption2, QOption3, QCategoryTagLvl1, QCategoryTagLvl2, QOptionalTag1, QOptionalTag2, QOptionalTag3, QOptionalTag4, QOptionalTag5, QTimePeriod, QDifficultyRating, QGenderBias, QAgeBias, QRegion, QWikiLink, QValidationLink1, QValidationLink2, QHint, QLastValidation, QNotes, QMultimediaType, QMultimediaLink, QLastAsked)"+ "VALUES (null,'Q00001','Example','Ans1','Q1','Q2','Q3','Q4','','','','','','','','','','','','','','','','','','','','')"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME); onCreate(db); } } Any suggestions at all would be great. I have tried debugging which suggests that the database does not exist. Thanks in advance for your assistance.

    Read the article

  • Javascript Recursion

    - by rpophessagr
    I have an ajax call and would like to recall it once I finish parsing and animating the result into the page. And that's where I'm getting stuck. I was able to recall the function, but it seems to not take into account the delays in the animation. i.e. The console keeps outputting the values at a wild pace. I thought setInterval might help with the interval being the sum of the length of my delays, but I can't get that to work... function loadEm(){ var result=new Array(); $.getJSON("jsonCall.php",function(results){ $.each(results, function(i, res){ rand = (Math.floor(Math.random()*11)*1000)+2000; fullRand += rand; console.log(fullRand); $("tr:first").delay(rand).queue(function(next) { doStuff(res); next(); }); }); var int=self.setInterval("loadEm()",fullRand); }); } });

    Read the article

  • ant - trying to copy to /lib/endorsed, library is not available in windows 7 to the next task

    - by kfox
    On Windows 7 I have an ant target that copies a xalan library into the jdk endorsed directory so that the next xslt transformation task can occur. The first time that the ant target runs, the xslt transformation fails. The second time it runs the jar file is already in the correct place and the xslt tranformation succeeds. The first time that the ant target runs, it looks like the file copied successfully. It feels like a timing issue, but I don't know what I can do to get around it. Here is my copy task: <mkdir dir="${java.home}\lib\endorsed"/> <copy file="${basedir}\xalan.jar" tofile="${java.home}\lib\endorsed\xalan.jar"/> Has anyone seen anything like this before?

    Read the article

  • jQuery - Targeting specific ID's

    - by Cecil
    Hey All, I have the following code: <script type="text/javascript" language="javascript"> $(document).ready(function() { $("input:checkbox").click(function(){ var group = "input:checkbox[name='"+$(this).attr("name")+"']"; $(group).attr("checked",false); $(this).attr("checked",true); }); }); </script> How do i get it to target a specific ID rather than every checkbox on the page? i.e if the group of checkboxes im trying to target is #thisgroup Cheers,

    Read the article

  • Maintaining a secure database of user logins and info?

    - by Rafe Kettler
    I want to have a login form on a charity website I am building (it's for a friend, and I'm learning on the go), and I want to know what languages/software should I learn to build databases for user logins and info? Note: it HAS to be secure and relatively simple to learn for someone with moderate programming experience. Update: I understand that CMSs offer good tools for logins etc. but I want to do this all by myself.

    Read the article

  • Mass 301 redirects mvc

    - by Massive Boisson
    Hi (this is a common problem with few twists). We are on IIS 6, without ISAPI_Rewrite with .net 4 and mvc 2 app. We would like to 301 forward bunch of old urls to matching new urls. (We are deploying a new site and google index will still point to old urls, and we need to map those urls to new urls) a) Is there a way to do this through IIS (but without ISAPI_Rewrite) and how? b) Is there a way to do this through the application code and how? All answers really appreciated, Thanks a lot --MB

    Read the article

  • WPF/MVVM - keep ViewModels in application component or separate?

    - by Anders Juul
    Hi all, I have a WPF application where I'm using the MVVM pattern. I get the VM activated for actions that require user input and thus need to activate views from the VM. I've started out separating the VMs into a separate component/assembly, partly because I see them as the unit testable part, partly because views should rely on VM, not the other way round. But when I then need to bring up a window, the window is not known by the VM. All introductions I find place the VM in the WPF/App component, thus eliminating the problem. This article recommends keeping them in separate layers : http://waf.codeplex.com/wikipage?title=Architecture%20-%20Get%20The%20Big%20Picture&referringTitle=Home As I see it, I have the following choices Move VMs to the WPF/App assembly to allow VMs to access the windows directly. Place interfaces of views in VM-assembly, implement views in WPF/App assembly and register the connection through IOC or alternative ways. File a 'request' from the VM into some mechanism/bus that routes the request (but which mechanism!? E.g something in Prism?!) What's the recommendation? Thanks for any comments, Anders, Denmark

    Read the article

  • Web Designer looking to learn back-end programming...

    - by Tabetha Moe
    Hello, my name is Tabetha and I have a question... I am a web designer, but I always find that while designing the layout and coding the design I come up with great ideas for websites. I would like to know where I need to start in order to learn back-end programming not only for the knowledge, but also for the challenge of it. I have searched online but can't seem to find the information I am looking for. If anyone can give me a simple, straight-forward "this is what language you need to learn" answer, or perhaps guide me in the right direction I would appreciate it ten-fold. I am a complete noob when it comes to this, so even the most basic information is probably a pearl of wisdom for me. :)

    Read the article

  • Rails 3 Join Question for Votes Table

    - by Dex
    I have a table posts and a polymorphic table votes. The votes table looks like this: create_table :votes do |t| t.references :user # user_id t.vote # the vote value t.references :votable # votable_type and votable_id end I want to list all posts that the user has not yet voted on. Right now I'm basically taking all the posts they've already voted on and subtracting that from the entire set of posts. It works but it's not very convenient as I currently have it. def self.where_not_voted_on_by(user) sql = "SELECT P.* FROM posts P LEFT OUTER JOIN (" sql << where_voted_on_by(user).to_sql sql << ") ALREADY_VOTED_FOR ON P.id = ALREADY_VOTED_FOR.id WHERE (user_id is null)" puts sql resultset = connection.select_all(sql) results = [] resultset.each do |r| results << Post.new(r) end results end def self.where_voted_on_by(user) joins(:votes.outer).where("user_id = #{user.id}").select("posts.*, votes.user_id") end

    Read the article

  • iOS4.2: TouchBegan does not draw more then one circle per sensed touch

    - by Christian
    Hi all, quick question (which might be a no-brainer for most here) :) My code below should draw a circle for every time touch that is recognised but although more than ones touches are sensed only one circle will drawn up at a time. Can anyone see any obvious issues? This method sits in the XYZViewControler.m class. TouchPoint.m is the class that defines the circle. Thanks a bundle for your help and redirects. Chris - (void) touchesBegan: (NSSet *) touches withEvent: (UIEvent *)event { NSSet * allTouches = [event allTouches]; // get all events for (UITouch * touch in touches) { TouchPoint * touchPoint = [[TouchPoint alloc] initWithFrame:CGRectMake(0, 0, circleWidth, circleWidth)]; touchPoint.center = [touch locationInView:[self view]]; touchPoint.color = [UIColor redColor]; touchPoint.backgroundColor = [UIColor whiteColor]; [[self view] addSubview: touchPoint]; [touchPoint release]; CFDictionarySetValue(touchMap, touch , touchPoint); } [[self view] setNeedsDisplay]; }

    Read the article

  • How do i set the proxy and SOCKs in libcurl?

    - by acidzombie24
    I am trying to configure my .NET app to use a proxy. My source is in C# but i learned CURL via C++. My question is where do i put the SOCKs IP and port? i looked through the documentation and didnt see it. I believe that is what is causing me these problems. When i run this code it will quiet literally timeout and not call my header function or writer function. If i comment out the first two curlopt lines (the two proxy lines) my code runs with no problems. In firefox i set the http proxy and SOCKs host separately, they are different IPs and ports. How do i set the sock part, the below has the dummy proxy set but i cant figure out the socks part. static void Main(string[] args) { SeasideResearch.LibCurlNet.Curl.GlobalInit((int)SeasideResearch.LibCurlNet.CURLinitFlag.CURL_GLOBAL_ALL); var curl = new Easy(); { curl.SetOpt(CURLoption.CURLOPT_PROXY, "http://127.0.0.1:1234"); curl.SetOpt(CURLoption.CURLOPT_PROXYTYPE, CURLproxyType.CURLPROXY_SOCKS5); curl.SetOpt(CURLoption.CURLOPT_URL, "http://whatismyipaddress.com/ip-lookup"); curl.SetOpt(CURLoption.CURLOPT_FOLLOWLOCATION, 1); curl.SetOpt(CURLoption.CURLOPT_USERAGENT, @"Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2b5) Gecko/20091204 Firefox/3.6b5"); curl.SetOpt(CURLoption.CURLOPT_HEADERFUNCTION, hf); curl.SetOpt(CURLoption.CURLOPT_HEADERDATA, data); curl.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf); curl.SetOpt(CURLoption.CURLOPT_WRITEDATA, sw); curl.SetOpt(CURLoption.CURLOPT_SSL_VERIFYPEER, 0); curl.Perform(); var sz = sw.ToString(); var myrealip = sz.IndexOf("12.34.56.78") !=-1; } //Console.WriteLine(sz); SeasideResearch.LibCurlNet.Curl.GlobalCleanup(); }

    Read the article

  • No component for supporting the service was found error

    - by Deepa
    We have setup a .net application developed with .net framework 4.0 using MVC framework and WCF service on a Windows 2003, 32-bit server containing IIS 6 successfully. However, when the same application is set up on a Win 2008 R2, 64-bit server, we get the following error when the application is accessing the WCF service: No component for supporting the service was found Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: Castle.MicroKernel.ComponentNotFoundException: No component for supporting the service was found We have set the flag for Enable 32-bit apps in "Application Pool" to true on the 64-bit server.

    Read the article

  • jQuery Tooltip plugin error

    - by hd
    i have written this code to apply 'jQuery Tooltip plugin' to ajax loaded elements. i mean the row i want to show tooltip on its mouseover is loaded into page by ajax. here's the code: $("[id^=pane]").delegate("[id^=comm]","mouseover",function() { $(this).tooltip({ // each trashcan image works as a trigger tip: "#tooltip", // custom positioning position: "center right", // move tooltip a little bit to the right offset: [0, 15], // there is no delay when the mouse is moved away from the trigger delay: 0 }).dynamic({ bottom: { direction: "down", bounce: true } }); }); the tooltip is shown when mouseover but firebug report this error: "$(this).tooltip({tip: "#tooltip", position: "center right", offset: [0, 15], delay: 0}).dynamic is not a function" is it because of using $(this) ???

    Read the article

  • static variable lose its value

    - by user542719
    I have helper class with this static variable that is used for passing data between two classes. public class Helper{ public static String paramDriveMod;//this is the static variable in first calss } this variable is used in following second class mathod public void USB_HandleMessage(char []USB_RXBuffer){ int type=USB_RXBuffer[2]; MESSAGES ms=MESSAGES.values()[type]; switch(ms) { case READ_PARAMETER_VALUE: // read parameter values switch(prm){ case PARAMETER_DRIVE_MODE: // paramet drive mode Helper.paramDriveMod =(Integer.toString(((USB_RXBuffer[4]<< 8)&0xff00))); System.out.println(Helper.paramDriveMod+"drive mode is selectd ");//here it shows the value that I need. ..........}}//let say end switch and method and the following is an third class method use the above class method public void buttonSwitch(int value) throws InterruptedException{ boolean bool=true; int c=0; int delay=(int) Math.random(); while(bool){ int param=3; PARAMETERS prm=PARAMETERS.values()[param]; switch(value){ case 0: value=1; while(c<5){ Thread.sleep(delay); protocol.onSending(3,prm.PARAMETER_DRIVE_MODE.ordinal(),dataToRead,dataToRead.length);//read drive mode System.out.println(Helper.paramDriveMod+" drive mode is ..........in wile loop");//here it shows null value }}//let say end switch and method what is the reason that this variable lose its value?

    Read the article

  • json null error help in php

    - by bobby
    I get 'json is null' as error My php file: <?php if (isset($_REQUEST['query'])) { $query = $_REQUEST['query']; $url='https://www.googleapis.com/urlshortener/v1/'; $key='ApiKey'; $result= $url.($query).$key; $ch = curl_init($result); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,1); $resp = curl_exec($ch); curl_close($ch); echo $resp; } ?> My html: <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ // when the user clicks the button $("button").click(function(){ $.getJSON("shortner.php?query="+$('#query').attr("value"),function(json){ $('#results').append('<p>Id : ' + json.id+ '</p>'); $('#results').append('<p>Longurl: ' + json.longurl+ '</p>'); }); }); }); </script> </head> <body> <input type="text" value="Enter a place" id="query" /><button>Get Coordinates</button> <div id="results"></div> Edited : <?php if (isset($_REQUEST['query'])) { $query = $_REQUEST['query']; $url='https://www.googleapis.com/urlshortener/v1/'; $key='Api'; $key2='?key='; $result= $url.$query.$key2.$key; $requestData= json_encode($result); echo var_dump($query); $ch = curl_init($requestData); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,1); $resp = curl_exec($ch); curl_close($ch); echo $resp; } ?>

    Read the article

  • Windows - How to remotely watch log files

    - by weismat
    I would like to look at some log files solely via the console on a standard Windows 7 machine. The logs are created by schedulded tasks and I find it a hazzle to use VNC for this purpose. What technology should I look at? Powershell, Cygwin via ssh or something else? The log files are written using log4Net - thus there might also be an easy way to reconfigure it to create events or something else for remote display.

    Read the article

  • vmware vmdk disk problem

    - by dmtr
    Hello, I have a vmware esxi 4 server and 2 storage servers (mount as nfs). Between the storage servers (fedora 14) is made drbd cluster (dual primary) and ocfs2 filesystem, also every server has local partition with ext4 filesystem, both are mounted as nfs on esxi server. When i tried to copy a virtual machine (naturally it power off) files from ext4 partition to ocfs2 partition, vmdk total file size is different, but md5sum is the same. on ext4 partition: # ls -la total 28492228 -rw------- 1 root root 42949672960 Jan 14 14:46 disk-flat.vmdk # md5sum disk-flat.vmdk 0eaebe3138beb32f54ea5de6dfe5a987 on ocfs2 partition: # ls -la total 13974660 -rw------- 1 root root 42949672960 Jan 14 16:16 disk-flat.vmdk # md5sum disk-flat.vmdk 0eaebe3138beb32f54ea5de6dfe5a987 When i power on the virtual machine from ocfs2 partition it dosn't work. I have a windows on the virtual machine and it freez?s after windows logo. From ext4 partition the virtual machine is worked. Test with linux (create and install on ext4 partition and copy) the same problem appears. When i create a virtual machine directly from ocfs2 partition, there are no problems. I tried to copy via vSphere client, and i have the same problem. Any suggestions ?

    Read the article

  • USB devices don't work after restoring from Stand By

    - by Steve
    Hi. I'm running Windows XP SP3 on a NEC Versa L1100 laptop. If I wake my laptop up from Stand By, no attached USB devices will function. Device Manager shows all USB entries to be working properly. There is an option to "Allow the computer to turn off this device to save power" in the Power Management properties of USB entries. Is this causing the issue or something else? I have the latest drivers for my motherboard installed.

    Read the article

  • Will the new Unity desktop be programmed in Qt?

    - by Brian Fleeger
    Will the desktop version of Unity, scheduled to appear in 11.04, be programmed using Qt? I ask this in relation to Matt Zimmerman's blog posting of several days ago, where he intimated that Qt was the more pragmatic choice for an SDK to get coders more involved. As a corollary, it would make sense if the whole desktop were in Qt, which would also make it possible to do a lot more beautiful effects, and make a more visually engrossing desktop experience. In any event, please elaborate on the future role of Qt in the Ubuntu desktop.

    Read the article

  • database schema eligible for delta synchronization

    - by WilliamLou
    it's a question for discussion only. Right now, I need to re-design a mysql database table. Basically, this table contains all the contract records I synchronized from another database. The contract record can be modified, deleted or users can add new contract records via GUI interface. At this stage, the table structure is exactly the same as the Contract info (column: serial number, expiry date etc.). In that case, I can only synchronize the whole table (delete all old records, replace with new ones). If I want to delta(only synchronize with modified, new, deleted records) synchronize the table, how should I change the database schema? here is the method I come up with, but I need your suggestions because I think it's a common scenario in database applications. 1)introduce a sequence number concept/column: for each sequence, mark the new added records, modified records, deleted records with this sequence number. By recording the last synchronized sequence number, only pass those records with higher sequence number; 2) because deleted contracts can be added back, and the original table has primary key constraints, should I create another table for those deleted records? or add a flag column to indicate if this contract has been deleted? I hope I explain my question clearly. Anyway, if you know any articles or your own suggestions about this, please let me know. Thanks!

    Read the article

  • Creating a WCF Restful service, concurrency issues

    - by pmillio
    Hi i am in the process of creating a restful service with WCF, the service is likely to be consumed by at least 500 people at any given time. What settings would i need to set in order to deal with this. Please give me any points and tips, thanks. Here is a sample of what i have so far; [ServiceBehavior(IncludeExceptionDetailInFaults = true, InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)] And this is an example of a method being called; public UsersAPI getUserInfo(string UserID) { UsersAPI users = new UsersAPI(int.Parse(UserID)); return users; } [OperationContract] [WebGet(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "User/{UserID}")] [WebHelp(Comment = "This returns a users info.")] UsersAPI getUserInfo(string UserID);

    Read the article

  • One-line expression to map dictionary to another

    - by No Such IP
    I have dictionary like d = {'user_id':1, 'user':'user1', 'group_id':3, 'group_name':'ordinary users'} and "mapping" dictionary like: m = {'user_id':'uid', 'group_id':'gid', 'group_name':'group'} All i want to "replace" keys in first dictionary with keys from second (e.g. replace 'user_id' with 'uid', etc.) I know that keys are immutable and i know how to do it with 'if/else' statement. But maybe there is way to do it in one line expression?

    Read the article

  • Using AND/OR mysql commands with FROM_UNIXTIME

    - by scatteredbomb
    Trying to select a query in php/mysql to get "Upcoming Items" in a calendar. We store the dates in the DB as a unix time. Here's what my query looks like right now SELECT * FROM `calendar` WHERE (`eventDate` > '$yesterday') OR (FROM_UNIXTIME(eventDate, '%m') > '$current_month' AND `$yearly` = '1') ORDER BY `eventDate` LIMIT 4 This is giving me an error "Unknown column '' in 'where clause'". I'm sure it has to do with my use of parenthesis (which I've never used before in a query) and the FROM_UNIXTIME command. Can someone help me out and let me know how I've screwed this up? Thanks!

    Read the article

  • What could cause a returning function to crash? C++

    - by JeanOTF
    So I have been debugging this error for hours now. I writing a program using Ogre3d relevant only because it doesn't load symbols so it doesn't let me stack trace which made finding the location of the crash even harder. So, write before I call a specific function I print out "Starting" then I call the function and immediately after I print "Stopping". Throughout the function I print out letters A-F where F is printed right before the function returns (one line above the last '}') The weird thing is when the crash occurs it is after the 'F' is printed but there is no 'Stopping'. Does this mean that the crash is happening in between somewhere? The only thing I can think of is something going wrong during the deallocation of some of the memory allocated during the function. I've never had anything happen like this, I will keep checking to make sure it's going wrong where I think it is.

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >