I need to store about 600,000 images on a web server that using NTFS. Am I better off storing images in 20,000-image chunks in subfolders? (Windows Server 2008)
I'm concerned about incurring operating system overhead during image retrieval
I'm trying to loop through the results from the Last.fm API but it's not working.
function get_url($url){
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,5);
$content = curl_exec($ch);
curl_close($ch);
return $content;
}
$xml = get_url('http://ws.audioscrobbler.com/2.0/?method=album.search&album=kid%20a&api_key=b25b959554ed76058ac220b7b2e0a026');
$doc = new SimpleXMLElement($xml);
$albums = $doc->results->albummatches;
foreach($albums as $album){
echo $album->album->name;
}
This just shows the first album. If I change the code within the foreach loop to echo $album->name; it shows nothing at all.
What am I doing wrong?
I would like to install an Apache server into a folder like c:\anything\???\anything2\ under windows.
When I try to start the service it sais that:
httpd: Syntax error on line xx of C:/anything/\xe6\x80\x98\xe6\x80\x99\e6\80\9a/anything2/apache/conf/httpd.conf: ServerRoot must be a valid directory
Does anyone have a solution?
I have been working on an app and during the development, I am facing a very strange problem. I have a NSMutableArray tempSortedArray, which is full of objects of Store types. All the objects are valid as I can see them in my GUI, the problem arises when I iterate through the array, at index 90, which can be generally anyone, the XCode converts the Store object to NSMutableArray object.
Any idea, why this is happening. This is the code to check out what I am doing:
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"cashBack"
ascending:NO];
NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
NSArray *sortedArray = [storesArray sortedArrayUsingDescriptors:sortDescriptors];
for (int i = 0; i < [tempSortedArray count]; i++) {
Store *currentStore = [tempSortedArray objectAtIndex:i];
NSLog(@"store class: %@", [currentStore.class description]);
if (currentStore.cashBackTypeString != (id)[NSNull null]) {
//do whatever is required to do here
}
What is the official DataGridView nomenclature description of the little black triangle in the first column?
It seems to mark the position of DataGridView.CurrentRow, but it's a get property only, and I'd like to set it.
The default when creating a new WebForm in Visual Studio is WebForm1.aspx
I always change this to Default.aspx.
Is there a way to change the default to always read Default.aspx?
I have an std class object from twitter and i would like to take the ids array values and put them in a php variable $ids where $ids = (15761916,30144785,382747195,19399719).
I imagine using a for loop and using phps implode but i'm not sure how to go about it.
stdClass Object
(
[ids] => Array
(
[0] => 15761916
[1] => 30144785
[2] => 382747195
[3] => 19399719
)
[next_cursor] => 0
[next_cursor_str] => 0
[previous_cursor] => 0
[previous_cursor_str] => 0
)
Is there a list anywhere that lists all the variables I can use in file names for report subscriptions from within SQL Server Management Studio? I currently use @timestamp in my file names, but would like to use other options or even remove parts of the time stamp (for example, just use the date, not the time).
Hi,
I have the following JSON object which has a date field in the following format:
{
"AlertDate": "\/Date(1277334000000+0100)\/",
"Progress": 1,
"ReviewPeriod": 12
}
I want to write a regular expression or a function to convert it to a javascript object so that it is in the form:
{
"AlertDate": "AlertDate":new Date(1277334000000),
"Progress": 1,
"ReviewPeriod": 12
}
The above date format fails validation in the JQuery parseJSON method.
I would like to convert the 1277334000000+0100 into the correct number of milliseconds to create the correct date when eval is called after validation.
Can anyone help me out with a good approach to solving this?
Cheers
Paul
I am using Drupal and have sifr set on list items, and also a, a:hover are set via Drupal so that the links hover. I looked at the sifr3-rules.js file drupal's render module creates and it looks good. and in fact my other sifr items look fine... But the list item ones are goofing for some reason... There is extra space below the list,
so if i have a list item, and inside of that, I have a unordered list with more list items, the Flash Object made in the 1st li (which will cover the rest of the sublist items too), is too bid so you see space under the children until the next parent li comes up. (so looks like extra bottom padding on that portion of the list in IE8... in FF almost similar but each subitem has space at bottom... with javascript turned off, you see the list items look fine by themselves)....
Also if the parent list item is shorter than the sub list items text, the width for the flash object is set only as long as the first list item, and therefore cuts off the rest the sublist item's text.
Any idea how to resolve any of these?
Only unusual thing i see i am doing is setting forceSingleLine and preventWrap (which dont make a difference if taken off).
****Edit, I may just try to figure out how to get Drupal's menu-block module to output a around my hyperlinks in the list items... then i can target the div's with my rule (and the a,a:hover rules will apply), so each menu item gets its own sifr object instead of sifr3 trying to figure out how to do the lists and sublists.
Very useful to me is anyone knows a way to target a hyperlink (<a> tag) and also allow a:hover rules. I know how to do it with pretend another tag that includes hyperlinks, like if i had <h2><a>sometitle</a></h2>, i could have a rule for h2, but then use the a, a:hover rules in the sifr3-rules.js file to target that. so i would need a way to target the hyperlink in the list, but also apply a :hover to it (not sure if this can be done since its not underneith for example the h2 tag).
Ok, so I'm very VERY new to MSMQ and I'm already confused.
I have created a private queue and added a few messages to it, all good so far. BUT when I retrieve the messages back from the queue the message body contains a empty object of the type I added. By this I don't mean that the body is null, it does have a reference to a type of the object that I added, but it's not instantiated so all the properties are in their null or default state.
This is the code I use to add to the queue:
using (var mQueue = new MessageQueue(QueueName))
{
var msg = new Message(observation)
{
Priority = MessagePriority.Normal,
UseJournalQueue = true,
AcknowledgeType = AcknowledgeTypes.FullReceive,
};
mQueue.Send(msg);
}
And this is the code that dequeues the messages:
using (var mQueue = new MessageQueue(QueueName))
{
mQueue.MessageReadPropertyFilter.SetAll();
((XmlMessageFormatter)mQueue.Formatter).TargetTypes =
new[] { typeof(Observation) };
var msg = mQueue.Receive(new TimeSpan(0, 0, 5));
var observation = (Observation)msg.Body;
return observation;
}
Under WindowsCE, C++ project, I'd like to get CPU utilization and memory allocation data real time - for logging and troubleshooting. Is there a library or activeX available that i could include in my code and use [without bringing my process to a halt, preferably], anyone knows?
thanks much for any insight!
O.
Hi,
I have a RoR application and model SomeModel. I have views for this model and I want to know - is there any method to get the view's path? Of course I can use for this model instance
m = SomeModel.new
v = m.class.class_name.pluralize.downcase
It's working, but maybe you know a better way? :)
It takes around a couple of seconds for my app to execute the code to send an email right now on a test server with nothing much else running. Not sure if this is typical/expected. I'm also using the php framework Kohana's email helper and not php's mail directly out of convenience if that matters. Is it always just better to schedule a cron job to send emails every 5 min or so? Or should I be able to send emails immediately and I'm just not doing something right?
What the script does is insert a row into the db and notifies the relevant group that the row was created. The groups are usually < 20 people so I just do a loop calling Kohana's email helper each time for each member of the group.
well, i have network that each proxy (lets assume we have 200 proxies), send UDP packages every constant amount of time. (let assume 10 seconds) to constant amount of hosts (lets assume 10)
my question is how will 6 * 10 seconds * 200 proxies * 10 target hosts = 120,000 UDP roundtrip communication per minute will affect my network, in terms of available connections, speed, stability, UDP package loss rate etc...
can anyone please refer me to some links on this issue ?
thanks
I am using a namespace called ComShorCaliburnWPF.ViewModules.Views.ShortMenuWindows.GWDSCT on my View.xaml and View.cs, for my ViewModel.cs and my IoC container I am using ComShorCaliburnWPF.ViewModules.Views.ShortMenuWindows.GWDSCT. When I remove the GWDSCT at the end it works fine, but in its current state it does not. I would like it to work how it is now because it accurately reflects where the files are located. Any suggestions?
Is there a way to convert a Json Object to a Multidimensional C# Array? I know it might be impractical but I can't be bothered to write classes and then deserialize the strings into them.
List<string> ohyeah = (List<string>)JsonConvert.DeserializeObject(g.CommToken);
That returns an Invalid Cast exception!
Example:
{"method":"getCommunicationToken","header":{"uuid":"9B39AAB0-49A6-AC7A-BA74-DE9DA66C62B7","clientRevision":"20100323.02","session":"c0d3e8b5d661f74c68ad72af17aeb5a1","client":"gslite"},"parameters":{"secretKey":"d9b687fa10c927f102cde9c085f9377f"}}
I need to get something like that :
j["method"]; //This will equal to getCommunicationToken
j["header"]["uuid"]; //This will equal to 9B39AAB0-49A6-AC7A-BA74-DE9DA66C62B7
I literally need to parse the json object into an array.
Simple question, how do I convert an associative array to variables in a class? I know there is casting to do an (object) $myarray or whatever it is, but that will create a new stdClass and doesn't help me much. Are there any easy one or two line methods to make each $key => $value pair in my array into a $key = $value variable for my class? I don't find it very logical to use a foreach loop for this, I'd be better off just converting it to a stdClass and storing that in a variable, wouldn't I?
class MyClass {
var $myvar; // I want variables like this, so they can be references as $this->myvar
function __construct($myarray) {
// a function to put my array into variables
}
}
Base on the documentation and sample code that I have gone through, I got an impression that when a class defined in xcode is read into and configured in Interface Builder, an object based on the class is effectively created and stored in an xib or nib file. So the object is ready to be used when the corresponding application is launched.
Alternatively, for classes that have not been handled by Interface Builder, code such as the "new" statements have to be written in xcode explicitly in order for the associated objects to be created and used.
It will be very nice to have people who are more knowledgable than me to confirm or to correct my very naive understanding of Interface Builder ...
I have some methods that return the number of weekdays between two given dates. Since calling these methods become very expensive to call when the two dates lie years apart, I'm wondering how these methods could be refactored in a more efficient way.
The returned result is correct but I feel that the iphone processor is struggling to keep up and consequently freezes up the application when I would call these methods over a period of say 10years.
Any suggestions ?
//daysList contains all weekdays that need to be found between the two dates
-(NSInteger) numberOfWeekdaysFromDaysList:(NSMutableArray*) daysList
startingFromDate:(NSDate*)startDate
toDate:(NSDate*)endDate
{
NSInteger retNumdays = 0;
for (Day *dayObject in [daysList objectEnumerator])
{
if ([dayObject isChecked])
{
retNumdays += [self numberOfWeekday:[dayObject weekdayNr] startingFromDate:startDate toDate:endDate];
}
}
return retNumdays;
}
-(NSInteger) numberOfWeekday:(NSInteger)day
startingFromDate:(NSDate*)startDate
toDate:(NSDate*)endDate
{
NSInteger numWeekdays = 0;
NSDate *nextDate = startDate;
NSComparisonResult result = [endDate compare:nextDate];
//Do while nextDate is in the past
while (result == NSOrderedDescending || result == NSOrderedSame)
{
if ([NSDate weekdayFromDate:nextDate] == day)
{
numWeekdays++;
}
nextDate = [nextDate dateByAddingDays:1];
result = [endDate compare:nextDate];
}
return numWeekdays;
}
when using a lock does the thing you are locking on have to be a object. For example is this legal
static DateTime NextCleanup = DateTime.Now;
const TimeSpan CleanupInterval = new TimeSpan(1, 0, 0);
private static void DoCleanup()
{
lock ((object)NextCleanup)
{
if (NextCleanup < DateTime.Now)
{
NextCleanup = DateTime.Now.Add(CleanupInterval);
System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(cleanupThread));
}
}
return;
}
EDIT--
From reading SLaks' responce I know the above code would be not valid but would this be?
static MyClass myClass = new MyClass();
private static void DoCleanup()
{
lock (myClass)
{
//
}
return;
}
I need to send an email in asp.net but I need sender appears like "MySiteName" without [email protected] need to send an email in asp.net but I need sender appears like "MySiteName" without [email protected]